@abstractmethod
def do_for_each_document(
self,
collection_name: str,
action: Callable[[dict], None]
) -> None:
r"""
Invokes the specified function once for each document in the specified collection.
This can be used to iterate over documents that you don't necessarily want to modify.
"""
pass
This method would be similar to the process_each_document method, but would not actually update the retrieved document—it would just use the retrieved document for something. In addition to, I think, making the API more intuitive to migrator authors, it may also improve performance (since it avoids one Mongo write operation for each document).
Proposed method signature
This method would be similar to the
process_each_document
method, but would not actually update the retrieved document—it would just use the retrieved document for something. In addition to, I think, making the API more intuitive to migrator authors, it may also improve performance (since it avoids one Mongo write operation for each document).