MongoDB Many-to-Many Association

Depending on your query needs you can put everything in the user document: {name:”Joe” ,roles:[“Admin”,”User”,”Engineer”] } To get all the Engineers, use: db.things.find( { roles : “Engineer” } ); If you want to maintain the roles in separate documents then you can include the document’s _id in the roles array instead of the name: {name:”Joe” … Read more