MongoDB start ID and end ID I want to insert bulk data into a MongoDB.
Later on I want to find exactly the bulk I inserted.

In MySQL I would have done:

 SELECT * FROM data WHERE id &gt;= start_id AND id &lt;= end_id


How can I fix this in MongoDB?
If you know start _id and end _id then you can retrieve the bulk you inserted using query like this:

db.yourCollection.find({_id:{$gt:ObjectId("56e13d5aed63a8477a7e2e78"), $lt: ObjectId("570f5a27b2d1a50996d3a0f0")}})


Replace the default mongodb ObjectIds with your _id fields.

Also, if the _id you are using is default mongodb ObjectId then you can easily compare them using above query since mongodb ObjectIds are monotonically increasing.