-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrations: Implement adapter method that copies values between two fields in all documents in a collection #2262
Conversation
|
Disregard - I see that this only makes a new field and that you'll need your second adaptor method to delete the contents of the original before implementing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good from my perspective, though I am not able to give the most thorough of review since these methods are a bit new to me. All the documentation and doctests make sense to me and match the descriptions.
Thanks for reviewing this! That level of review is helpful for me (e.g. in case I made a mistake somewhere while implementing this in haste). Rather than merge this in, I'd prefer to merge the third PR I opened this afternoon, since it includes these changes. That PR is: #2265 |
On second thought, I implemented that third PR in a way where this can be merged in independently. I'll go ahead and merge this in. |
In this branch, I implemented an adapter method named
copy_value_from_field_to_field_in_each_document
, which migrator authors can use to copy all values in one field of a document into another field of that same document (creating the latter field if it doesn't already exist), for every document in a given collection.Previously, migrator authors could do this by iterating over documents in Python. This new adapter method delegates the iteration to MongoDB.
Fixes #2259