Skip to content

Allow using update functions returning undefined #34

@LucVidal360

Description

@LucVidal360

Context

It's possible to build a MongoBulkDataMigration config with the update option being a function.
In this case, the function will be called for each document to update, and return the desired document update.

It is possible that we can detect only at runtime that a document doesn't really need to be updated (e.g., the matching query returns too many documents, and we need to request another collection to decide what should be updated).

So we could reduce the total number of updates by simply allowing the update option to return undefined when a document should not be updated.

Note about the bulk batch size option

We call the bulk batch update every maxBulkSize queried documents.
If all of them should not be updated, we could attempt to run an empty bulk!

Specification

  • when it's a function, allow the update option to return undefined
    • in this case, do not update the corresponding document

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions