D
D
ddgryaz2021-09-08 12:42:01
MongoDB
ddgryaz, 2021-09-08 12:42:01

How to change system.roles MongoDb collection?

Good day!
In the database - admin, there is a collection - system.roles, the document in which I need to edit. It looks like this:

{
    "_id" : "admin.AuthAppRole",
    "role" : "AuthAppRole",
    "db" : "admin",
    "privileges" : [ 
        {
            "resource" : {
                "db" : "publicName",
                "collection" : "testApp"
            },
            "actions" : [ 
                "insert"
            ]
        }
    ],
    "roles" : [ 
        {
            "role" : "readWrite",
            "db" : "Auth"
        }, 
        {
            "role" : "dbAdmin",
            "db" : "Auth"
        }
    ]


I'm logged into monge with the following user:

{
    "_id" : "admin.***",
    "userId" : ***,
    "user" : "***",
    "db" : "admin",
    "roles" : [ 
        {
            "role" : "clusterAdmin",
            "db" : "admin"
        }, 
        {
            "role" : "readWrite",
            "db" : "admin"
        }, 
        {
            "role" : "read",
            "db" : "admin"
        }, 
        {
            "role" : "dbAdmin",
            "db" : "admin"
        }, 
        {
            "role" : "readAnyDatabase",
            "db" : "admin"
        }, 
        {
            "role" : "readWriteAnyDatabase",
            "db" : "admin"
        }, 
        {
            "role" : "dbAdminAnyDatabase",
            "db" : "admin"
        }, 
        {
            "role" : "userAdmin",
            "db" : "admin"
        }, 
        {
            "role" : "userAdminAnyDatabase",
            "db" : "admin"
        }
    ],
    "mechanisms" : [ 
        "***", 
        "***"
    ]
}


When I try to edit a document or create a new one, I get the following error:

Not authorized on admin to execute command { update: "system.roles", $db: "admin" }

Tried via robo3t interface and mong shell. Monga is deployed as a replica set.
I need to add a couple of actions to this role.

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
ddgryaz, 2021-09-08
@ddgryaz

The question is closed.
SO Answer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question