Hi,
i am trying to update the password and received the below message.
db.updateUser(“globalAdminUser”, { roles : [ { role : “readWrite”, db : “admin” } | “admin”, ], pwd : “6c%dbe&7dc!ee1#d”, mechanisms :[“SCRAM-SHA-1”], }, )
uncaught exception: Error: Updating user failed: User and role names must be either strings or objects :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.updateUser@src/mongo/shell/db.js:1436:11
@(shell):1:1
steevej
(Steeve Juneau)
August 25, 2021, 1:42pm
2
Most likely the presence of the non JSON character | just before the second "admin" value.
steevej
(Steeve Juneau)
September 1, 2021, 12:58pm
4
Not sure, but the last comma before the closing brace might be wrong.
The comma is used to separate fields in a JSON document.
Sai_Geethanjali:
db.updateuser( “readWriteInventoryUser”, { roles: [ {role: “readWrite”, db: “admin”}], pwd : “6c%dbe&7dc!ee1#d”, mechanisms : [“SCRAM-SHA-1”], } )
i used a wrong function to update password.
db.changeUserPassword() to be used
system
(system)
Closed
September 7, 2021, 12:35pm
6
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.