I'm trying to execute the following 'query' on the primary node of my mongodb cluster:
> db.system.sessions.count()
The cluster gives me an error as follow:
"not authorized on admin to execute command", "unauthorized"
The docs said that the role 'root' has implicitly the 'clusterAdmin' role, what I suppose is enough to query the sessions count.
This is the user/roles I'm logged in:
{
"user" : "admshard",
"db" : "admin",
"roles" : [
{
"role" : "root",
"db" : "admin"
},
{
"role" : "clusterManager",
"db" : "admin"
},
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
},
{
"role" : "dbOwner",
"db" : "admin"
}
]
}
My mongodb version is 4.2.3. I'm working with 2 databases and 2 arbiters.
Any clue about this?
Thanks!!
system.sessions
collection is inconfig
database. – prasad_{ role : "root", db: "admin"}
should permit almost everything. Did you connect with correct password? – Wernfried Domscheitsystem.sessions
collection and he/she had to give access (grant a role) to the collection specifically. I tried the same, but no results. – thatsallfolks