References

Using references (https://docs.mongodb.com/manual/reference/database-references/), it is possible to create a series of related collections in order to establish a normalized (https://docs.mongodb.com/manual/core/data-model-design/#normalized-data-models) data model. In the following diagram, a normalized data model is established by defining a field purchId, which forms a reference between the Customer collection and Purchases. Further, the field itemId can serve as a reference between Purchases and Products:

By imposing an SQL-esque solution on a MongoDB dataset, however, you defeat the purpose of using a NoSQL database. Unless ...

Get MongoDB 4 Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.