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?
2 Answers
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. Commented Nov 23, 2016 at 18:23
They have added collection-access ACLs, see here: http://docs.mongodb.org/manual/core/collection-level-access-control/
mongod
instances to only be able to r/w certain collections within a database?user based
solutions here. Good to know!