I have a MongoDB user created into admin
database
When i try to use some functions (from mongoDB native driver in nodeJs) it throws an error:
{ name: 'MongoError', message: 'not authorized on stop to execute command { findandmodify: "users", query: { _id: 1 }, new: true, remove: false, upsert: true, update: {...
{
"_id" : "admin.admin",
"user" : "admin",
"db" : "admin",
"credentials" : {
"SCRAM-SHA-1" : {
"iterationCount" : 10000,
"salt" : "xxxx",
"storedKey" : "xxxx",
"serverKey" : "xxxx"
}
},
"roles" : [
{
"role" : "root",
"db" : "admin"
},
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
},
{
"role" : "readWriteAnyDatabase",
"db" : "admin"
},
{
"role" : "dbOwner",
"db" : "admin"
},
{
"role" : "clusterAdmin",
"db" : "admin"
}
]
}
Any other commands like find
or update
works.
I want this user to be a SUPER USER
but I have assigned it all type of roles, but none of them works, i tried root
, adminAnyDatabase
, etc.
I'm using mongodb 3.0.9
Any idea how to solve this? Which permision do i need to allow findAndModify
command?