Reputation: 4362
I have one collection and I want to move some of it's to another collection.
For example, I have a lot of documents in collection A and I want to move all 1 month older documents to collection B (these 1 month older documents should not be in collection A).
I using Python for this job. How can I control the documents that are removed from Collection A transferred to Collection B? And the documentary has not gone away?
one solution that I know is:
step one :
I move documents to temp place (for example MySql)
step Two :
second code read all document from temp place, and then move to Collection B.
step three :
third code deletes from Collection A.
Do you know another solution?? how can I make sure documents are deleted from Collection A
, only if Collection B
has been inserted successfully
Upvotes: 0
Views: 305
Reputation: 15789
To me this sounds a much better way (as long as all fields as stored):
Of course you can verify the number of docs match by issues searches to the new collection and to the current one (instead of the delete)
Upvotes: 1