0

I am trying to update bulk of documents in collection using mongodbwith different values for field. I have unique Id for each document. I need to update bulk of records in single update command. How do we update bulk of documents. Please suggest the approaches to solve this.

mukund shelke
  • 429
  • 1
  • 4
  • 12
  • [`bulkWrite()`](http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#bulkWrite). Is there actually a question other than *"Please search the documentation for me"*? – Neil Lunn Nov 06 '17 at 06:12

1 Answers1

1

You can update multiple records with below command,

db.getCollection('collectionName').update({'condition if any'},{$set: { field:value}}, {multi:true})
chetan mekha
  • 665
  • 6
  • 18
  • It's right . But each documents having changes in different fields not the same field. Not same field for all documents . I need to update whole documents with different values for different fields. Is the mentioned way is feasible way to do so ? – mukund shelke Nov 06 '17 at 08:52