I have several databases on my MongoDB, all of them have or will have a collection called _schema
. Currently, I'm granting permissions like this:
db.grantRolesToUser("userA",[
{"role": "readWrite", "db" : "databaseA", "collection": "_schema"}
]);
db.grantRolesToUser("userA",[
{"role": "readWrite", "db" : "databaseB", "collection": "_schema"}
]);
.
.
.
db.grantRolesToUser("userA",[
{"role": "readWrite", "db" : "databaseZ", "collection": "_schema"}
]);
Is there a way to grant readWrite
for that particular collection on all databases without granting on each db individually?
(I want the write
permission just for that collection, others will be just read
)
resource
would be{ cluster : true }
?resource: { db: "", collection: "_schema" }
, see Specify Collections Across Databases as Resource