I'm just making my hands dirty(handson) with MongoDB. First I did bulk insert of 1 million documents.

// Bulk insert query
var bulk = db.bulktest.initializeUnorderedBulkOp();
for(var i=0;i<1000000;i++){bulk.insert({a:i});}

It took 10 seconds to insert all the document which is comparatively good. None of the documents were missed.

However, when it comes to bulk find and removal, the performance has drastically came down and is really bad as it is removing each document in the order of 10ms.

// find and removal bulk query
var bulk = db.bulktest.initializeUnorderedBulkOp();
for(var i=0;i<1000000;i++){bulk.find({a:i}).remove();}

Has anyone done tweaking around bulk removal ?

I've only one option to drop the complete collection and I don't want to do this.


1 Answer 1


This shouldn't have anything to do with bulk operations. The find operation must read through the collection, which takes time on 1million documents.

Adding an index on a should improve the speed dramatically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.