mongodb collection level access control with wildcard

Viewed 309

I am going to have my collections named as 'a', 'a.b', 'a.b.c'... in the format of a package names. I want to create roles in mongodb like below,

db.createRole(
   {
     role: "regexAccess",
     privileges: [
       { resource: { db: "scriptrepo", collection: "a.*" }, actions: [ "find","update","insert","remove" ] }
     ],
     roles: []
   }
)

Is it possible to do such a thing in MongoDB?

1 Answers

It is not possible to use regex in the name of the collections while creating roles. The exact name of the collection's are to be used.

Related