A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/manual/data-modeling/concepts/embedding-vs-references/ below:

Embedded Data Versus References - Database Manual

Effective data models support your application's needs. One key decision for your schema design is whether to embed data or use references.

You can embed related data in a single document. In the following example, the contact and access fields are embedded documents:

Embedded data models are often denormalized, because frequently-accessed data is duplicated in multiple collections.

Embedded data models let applications query related pieces of information in the same database record. As a result, applications require fewer queries and updates to complete common operations.

Use embedded data models in the following scenarios:

Embedding provides the following benefits:

To query data within embedded documents, use dot notation. For examples of querying data in arrays and embedded documents, see:

Note Document Size Limit

Documents in MongoDB must be smaller than 16 mebibytes.

For large binary data, consider GridFS.

References store relationships between data by including links, called references, from one document to another. In the following example, the contact and access documents contain a reference to the user document.

References result in normalized data models because data is divided into multiple collections and not duplicated.

Use references to link related data in the following scenarios:

To query normalized data in multiple collections, MongoDB provides the following aggregation stages:

For an example of normalized data models, see Model One-to-Many Relationships with Document References.

For examples of various tree models, see Model Tree Structures.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4