Back

Adding New Field to User Collection

  • 0
  • Databases
  • Auth
  • Web
  • Cloud
Ramen
13 Mar, 2024, 17:53

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.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more