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.

1
  • bulkWrite(). Is there actually a question other than "Please search the documentation for me"? Commented Nov 6, 2017 at 6:12

1 Answer 1

1

You can update multiple records with below command,

db.getCollection('collectionName').update({'condition if any'},{$set: { field:value}}, {multi:true})
Sign up to request clarification or add additional context in comments.

1 Comment

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 ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.