java mongo driver has a findAndRemove method which finds some documents specified by a query and removes them.
My problem is how to find and remove specified (forexample 100) number of documents from a collection.
That would be something like
DBObject objects= db.getCollection("someCollection").findAndRemove( 100) ;
where objects is a list of deleted objects
findAndRemoveis implemented viafindAndModify, which in turn has the following limitation:(from
findAndModifydocumentation)