Function createBatchMigrator

  • Creates a migrator that facilitates database migrations. Accepts a custom traverser object as argument which the migrator will use when traversing the collection and writing to documents. This migrator uses atomic batch writes when writing to docs so the entire operation will fail if a single write isn't successful.

    Type Parameters

    • D = DocumentData

    Parameters

    • traverser: Traverser<D>

      The traverser object that this migrator will use when traversing the collection and writing to documents.

    Returns BatchMigrator<D>

    A new BatchMigrator object.

    Remarks

    Note that the TraversalConfig.batchSize config value must not exceed 500 for a traverser used in a BatchMigrator. This is because in Firestore, each write batch can write to a maximum of 500 documents.

    Throws

    InvalidConfigError Thrown if the traversal config of the specified traverser is not compatible with this migrator.

  • Creates a migrator that facilitates database migrations. The migrator creates a default traverser that it uses when traversing the collection and writing to documents. This migrator uses atomic batch writes when writing to docs so the entire operation will fail if a single write isn't successful.

    Type Parameters

    • D = DocumentData

    Parameters

    • traversable: Traversable<D>

      A collection-like traversable group of documents.

    • Optional traversalConfig: Partial<TraversalConfig>

      Optional. The traversal configuration with which the default traverser will be created.

    Returns BatchMigrator<D>

    A new BatchMigrator object.

    Remarks

    Note that the TraversalConfig.batchSize config value must not exceed 500 for a traverser used in a BatchMigrator. This is because in Firestore, each write batch can write to a maximum of 500 documents.

    Throws

    InvalidConfigError Thrown if the specified traversalConfig is invalid or incompatible with this migrator.

Generated using TypeDoc