How to implement somethings similar to db.collection.find().limit(10) but while updating documents?
Now I’m using something really crappy like getting documents with db.collection.find().limit() and then updating them.
In general I wanna to return given number of records and change one field in each of them.
Thanks.
Unfortunately the workaround you have is the only way to do it AFAIK. There is a boolean flag
multiwhich will either update all the matches (whentrue) or update the 1st match (whenfalse).