5

I'm building a backend system using MongoDB. Now I want to restrict access on certain numbers of database collections to this system. For example I have users, admin_users, pageviews and I want this system to be able to read and write only admin_users and pageviews collections but no read or write access on users colection. Is there any ways to do so?

3
  • Are you looking to restrict certain mongod instances to only be able to r/w certain collections within a database? Commented Nov 26, 2013 at 12:39
  • I'm not database admin, so my understanding about mongod instances is not very good. I want to add a new database user to db who can only read or write certain numbers of collections.
    – Khanh Tran
    Commented Nov 26, 2013 at 12:45
  • 1
    Ah, so you're looking for user based solutions here. Good to know! Commented Nov 26, 2013 at 12:52

2 Answers 2

2

To the best of my knowledge, there is not yet any built in way (as of version 2.4) to provide access-control at the collection level. Mongo's ACLs go to the Database only. To do what you want you will have to move that users collection to a different database.

1
  • May want to edit this as current versions do support this. Commented Nov 23, 2016 at 18:23
3

They have added collection-access ACLs, see here: http://docs.mongodb.org/manual/core/collection-level-access-control/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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