lundi 29 juin 2015

How to insertmany from a cursor using Pymongo?


I am interested in using a cursor to duplicate a database from one mongod to another. I want to limit the amount of insert requests sent so instead of inserting each document in the cursor individually I want to do an insert_many of each cursor batch.

Is there a way to do this in pymongo/python?

I have tried converting the cursor to a list and then calling insert_many and this works, but if the collection is over the amount of ram that I have then it won't work.

Any ideas on how to grab a batch from a cursor and convert it to a list would be appreciated

Thanks!


Aucun commentaire:

Enregistrer un commentaire