I'm trying to find a good way to manage permissions for a high number of mongo documents.

What I want to do: Apply group/user/and or application permissions to mongo documents.

Idea 1: Use mysql to control the relationship (con's duplication of data, 2 diff systems)

Idea 2: Add metadata to each document (con's: would have to update a ton of doc)

Idea 3: Create another collection to manage the relationship (leaning toward this)

I keep going in circles.. posting here out of desperation. If anyone has a design pattern or any ideas I'd really appreciate it.

I'm dealing with high number of mongo docs (1 million+) and am trying to avoid the situation where I need to update a high number of doc's every time a new group/application/permission is added for a doc or subset of doc's.


  • What about role-based permissions? Wouldn't you avoid the situation described in your last paragraph if you restricted permissions to a particular role or roles? – Robert Harvey Apr 28 at 19:36
  • Poss.. thing is we aren't using roles and I don't know upfront what the groups/users/applications are. So I'm trying to design a schema that can support future changes without having to update a ton of docs. I'm kinda leaning toward having one collection just for permissions and joining on the collection for docs. mongodb.com/blog/post/… – daynok Apr 28 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.