0

When I query my mongodb collection with a query I get multiple documents found.

According to the documentation , "the update() method updates a single document". And I cannot use the multi:true option, since I want to update the different documents found with different values so:

I would like to do the following:

  1. Update the first document with :
db.collection('foo').update(query,{$set : {'qux':'bar'}})
  1. Update the second document with
db.collection('foo').update(query,{$set : {'qux':'blep'}})

Close to this, but not quite getting there MongoDB: How to update multiple documents with a single command?

Worth reading :)

Ola Karlsson
  • 141
  • 1
  • 2
  • 10

0 Answers0