0

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)

4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.