thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Intermediate

Document Embedding

Storing related data inside a parent document (embedding) rather than in a separate collection with references.

Definition

Embed data that is read together and has a bounded one-to-few relationship. Reference data that is unbounded, large or shared across documents. The MongoDB guideline is that data accessed together should be stored together.

Example

Embedding order line items in an order document.

Exam tip

Unbounded arrays, such as all comments ever made on a popular post, should be referenced, not embedded.

Related terms