Add new field to every document in a MongoDB collection
Asked 07 September, 2021
Viewed 1.8K times
  • 61
Votes

How can I add a new field to every document in an existent collection?

I know how to update an existing document's field but not how to add a new field to every document in a collection. How can I do this in the mongo shell?

6 Answer