I added a new ENUM attribute for roles of a user like admin, moderator or user. How do I give all existing documents an updated default value of user for that field?
TL;DR
Developers want to add a new field to the user collection with default values. To update all existing documents with a default value for the new field, developers can use the update() method in MongoDB to set the new field value for all existing documents in the collection.