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
Context
It's possible to build a
MongoBulkDataMigrationconfig with theupdateoption 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
updateoption to returnundefinedwhen a document should not be updated.Note about the bulk batch size option
We call the bulk batch update every
maxBulkSizequeried documents.If all of them should not be updated, we could attempt to run an empty bulk!
Specification
updateoption to returnundefined