Schema Design Considerations in MongoDB

By Ken W. Alger

Elevator Pitch

One of the key things when modeling your data in MongoDB is how the application is going to use the data. Data access patterns should be of foremost thought when designing your data model. When does one decide to embed documents inside another document? What are some schema design considerations?

Description

In the relational database world modeling different relationships comes down to examining how to model “One-to-N” relationships and the normalization of data. In MongoDB, there are a variety of ways to model these relationships. When doing schema design in MongoDB there is more to consider than a blanket model for a “One-to-N” relationship model.

We need to consider the size of “N” for our modeling because in this instance, size matters. One-to-one relationships can easily be handled with embedding a document inside another document. But what happens if “N” grows? Let’s have a look at the following cases, “One-to-few”, “One-to-Many”, and “One-to-Tons”.

Notes

I am a MongoDB Certified Developer #560-664-214 and am a frequent blogger on MongoDB.

For this talk, the technical requirements would be a projector with an HDMI connection (preferred).