Articles → MONGODB → Db.Updateuser() Function In MongodbDb.Updateuser() Function In MongodbIn this article, we will discuss the db.updateUser() function in MongoDB.Purpose The db.updateUser() function updates the user profile on a database.Example Consider the following user: -We will use the function to update the role of the user. For that, we will use the following command: -db.updateUser("gyan", { roles: [ { role: "readWriteAnyDatabase", db: "admin" } ] })Output Posted By - Karan Gupta Posted On - Wednesday, July 24, 2024 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
db.updateUser("gyan", { roles: [ { role: "readWriteAnyDatabase", db: "admin" } ] })
Query/Feedback