Embedded documents

A better data-modeling solution would be simply to collapse the normalized relationships and fold the related information into embedded (https://docs.mongodb.com/manual/core/data-model-design/#data-modeling-embedding) documents. Using the preceding example, the better solution would appear as follows:

Using embedded documents, with a single query, you can easily obtain a consolidated block of information, which includes the customer name, purchase date, and specifics on the item.

MongoDB also supports creating indexes (https://docs.mongodb.com/manual/indexes/) on any given field, which boosts query performance. The auto-generated ...

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.