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?

  • Are you looking to restrict certain mongod instances to only be able to r/w certain collections within a database? – sysadmin1138 Nov 26 '13 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. – petwho Nov 26 '13 at 12:45
  • 1
    Ah, so you're looking for user based solutions here. Good to know! – sysadmin1138 Nov 26 '13 at 12:52
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.

  • May want to edit this as current versions do support this. – LowlyDBA Nov 23 '16 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, privacy policy and cookie policy

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