I've been able to do a register and login using MongoDB Stitch but I can't find how to update a user's data. I've tried making queries to db.users or db.user but these don't exist.
Is there a method to update a user?
To authenticate a client in MongoDB, you must add a corresponding user to MongoDB. You can add a user with the db.createUser () method using mongosh. The first user you create must have privileges to create other users. The userAdmin or userAdminAnyDatabase role both confer the privilege to create other users.
For users created in MongoDB, MongoDB stores all user information, including name, password, and the user's authentication database, in the system.users collection in the admin database. Do not modify this collection directly. To manage users, use the designated user management commands.
Starting in version 4.2 of the mongo shell, you can use the passwordPrompt () method in conjunction with various user authentication/management methods/commands to prompt for the password instead of specifying the password directly in the method/command call.
I communicated with support and they told me that there is no way to update a user's profile as they are stored in a internal database that is not accesible to the developer. I suggested that this must be explained in the guides but they didn't (or I couldn't find it, please comment and I'll edit).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With