1

Im triying to create users in a database in mongo, I want to lock the usage of te collections for some users, I'll give an example:

Lets say that I actually have a db with 3 collections:

Books, Students, Proffesors

And 3 users:

Librarian, SecretaryManager, Director

And I want the Librarian have r/w permissions just in Books, SecretaryManager r/w permissions in Students and Professors, and finally, Director that would have the same permissions as Librarian + SecretaryManager.

I've readed the documentation of mongo main website, im aware of using db.adduser, but I haven't find the way of doing this or I've miss something.

Need help, thanks in advance.

0

1 Answer 1

1

At the time of writing this (2.4 is the stable release) you would have to split up these collections into three databases instead. The ability to do collection level permissions is not available, so you need to do it at the database level. If you alter your model to have 3 databases (Books, Students, Professors), then you can add the relevant users to each database using db.addUser as you require.

However, if that is not possible for some reason, it is worth noting that collection level access control is slated to be a feature in 2.6 (the next major release) which is due soon (tm). The usual caveats apply, nothing is truly in a release until you see the actual binary and confirm it, but this feature (as part of SERVER-1105) is already marked as committed and closed. It is available for testing in the development releases right now. The documentation (once complete) will be available at:

http://docs.mongodb.org/master/release-notes/2.6/#collection-level-access-control

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.