diego.earth
homewritingphotostalksabout

About MongoDB and many-to-many associations

This little fragment from mongo_mappers gem documentation made my day.

Posted in Databases

June 11, 2014 - 1 min read

In a relational database, you might model a many-to-many relationship by creating a “join table.” MongoDB doesn’t have joins. But because arrays are first class citizens in MongoDB, you can simply store an array of ObjectId’s.