Articles → MONGODB → Db.Updateuser() Function In Mongodb

Db.Updateuser() Function In Mongodb






Purpose





Example




Picture showing the sample user in mongodb




db.updateUser("gyan", {
  roles: [
    { role: "readWriteAnyDatabase", db: "admin" }
  ]
})


Picture showing updating the user using the updateuser function in mongodb



Output


Picture showing the user after update



Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, July 24, 2024

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250