Minimum permission for using mongodump (to dump a specific db)

前端 未结 4 1601
不知归路
不知归路 2021-02-01 16:59

We can\'t seem to find any conclusive document on what permissions (user roles) are required to run mongodump on a specific db.

Say I have a db named

4条回答
  •  无人共我
    2021-02-01 17:56

    This minimal set of privileges seems to work fine for me (note that the built-in 'backup' role exists only in the 'admin' database'). The first privilege is needed to get rid of the [myDb.system.indexes: not authorized on myDb to execute command { count: "system.indexes", query: {} }] error:

    db.createRole({
         role: "myDumpRole",
         privileges: [
           { resource: { db: "myDb", collection: "system.indexes" }, actions: [ "find"] },
           { resource: { db: "myDb", collection: "" }, actions: [ "find", "listCollections", "listIndexes", "indexStats"] }
         ]
    });
    

提交回复
热议问题