Lets say I have a 10 documents of Item
in the database.
Lets retrieve 3 documents of Item matching some condition using limit().
documents = Item.objects(somefield=somecondition).limit(3)
Now if I do
documents.update()
, mongoengine updates all the documents in the database matched by the query not just the 3 documents I have limited my query to.
I also tried setting multi=False
in the params, but then only one document gets updated.
Is there anyway to do update while querying itself instead of looping over the documents one by one?