---
title: "Embed vs. Reference: Data Modeling Explained"
date: 2026-02-23T12:00:00-06:00
author: Nick Lorang
canonical_url: "https://www.lemonly.com/work/mongodb-embed-vs-reference"
section: Work Item
---
[](https://www.lemonly.com/work)# [MongoDB](https://www.lemonly.com/work?client=mongodb) Embed vs. Reference: Data Modeling Explained 

 [Video](https://www.lemonly.com/work?category=video)[MongoDB](https://www.mongodb.com) helps developers build and scale applications with flexible, document-based data — but knowing how to *structure* that data is its own puzzle. For their "Lightbulb Moments" video series, MongoDB tapped Lemonly to break down one of the trickiest early decisions in database design: whether to embed data or use references.

The result is a snackable explainer that turns a technical concept into something anyone can digest — literally. Using pizza as our guide, we show how embedding is like grabbing a pre-made pie (fast, convenient, all-in-one) while referencing is like keeping your dough, sauce, and toppings in separate containers (more flexible, but more steps). The video walks through the trade-offs of each approach and lands on a simple rule of thumb: Data that's accessed together should be stored together.

The real challenge was making an abstract, developer-level concept click for technical and nontechnical viewers alike — without dumbing it down. By leaning into a metaphor everyone already understands (who doesn't have feelings about pizza toppings?), we gave MongoDB a lightbulb moment that's as clever as it is clear.

 

  

## Share

- [  ](http://www.facebook.com/sharer.php?u=https://www.lemonly.com/work/mongodb-embed-vs-reference&p%5Btitle%5D=Embed%20vs.%20Reference%3A%20Data%20Modeling%20Explained)
- [  ](https://www.linkedin.com/shareArticle?mini=true&url=https://www.lemonly.com/work/mongodb-embed-vs-reference&title=Embed%20vs.%20Reference%3A%20Data%20Modeling%20Explained)
- [  ](https://www.pinterest.com/pin/create/button/?url=https://www.lemonly.com/work/mongodb-embed-vs-reference&media=https://www.lemonly.com/general-uploads/Work/260528_MongoDB_Lightbulb-Video-Series-Referencing_VID_Work-Thumbnail.jpg&description=Embed%20vs.%20Reference%3A%20Data%20Modeling%20Explained)
- [  ](mailto:?body=Check%20this%20out!%20https://www.lemonly.com/work/mongodb-embed-vs-reference&subject=Embed%20vs.%20Reference:%20Data%20Modeling%20Explained)
 

View Text

 

When it’s time to set up your data in MongoDB, you have an important decision to make: Should you embed your data in documents or use references?

Think of it like preparing a pizza: You can either heat one up from a box or make your own with custom toppings.

Embedding data is your pre-made pizza — fast, convenient, and served as a single unit. It’s a great strategy for when you always need to access the same data together.

MongoDB’s secondary indexes are like the words on the box; they help you find “pizzas without ham” or “pizzas with pineapple,” if you’re into that sort of thing. But when you grab your box, you’re grabbing the whole thing — you can’t take just the pepperoni and leave the cheese behind. In the same way, querying an embedded document means you retrieve all the embedded data, even if you only need part of it.

When you want only a subset of data, it’s best to keep things separate. That’s when creating references comes in handy. Your references are like different ingredients stored in different containers. You can keep your dough, sauce, cheese, and toppings on their own and update or swap a single ingredient without touching the others.

The trade-off? Making each pizza takes longer. Instead of grabbing one box, you’re visiting multiple containers for your dough, cheese, and toppings. In database terms, that means you need multiple queries to fetch all your related data.

So, how do you know when to embed or reference? Always remember: Data that is accessed together should be stored together. Embed when data is naturally consumed as a whole, and reference when you want the flexibility to mix and match. You can do it all with MongoDB.

 

 

---

## Other work in this series

   
 

   [   ![](https://d2xoo2expjpog9.cloudfront.net/generalUploads/Work/260528_MongoDB_Lightbulb-Video-Series-Search_VID_Work-Thumbnail.jpg?mode=crop&pos=center-center&q=98&f=webp&c=a669fb0f&v=82a259bd9960269e75e734e7aabe94d1b235621b0b6de5142ae004fc57499fcc)  ](https://www.lemonly.com/work/mongodb-atlas-search)  [MongoDB](https://www.lemonly.com/work?client=mongodb)[Atlas Search in MongoDB Explained](https://www.lemonly.com/work/mongodb-atlas-search)

 [Video](https://www.lemonly.com/work?category=video) 

   [   ![Data Indexing Fundamentals Explained - MongoDB](https://d2xoo2expjpog9.cloudfront.net/generalUploads/Work/260528_MongoDB_Lightbulb-Video-Series-Indexing_VID_Work-Thumbnail.jpg?mode=crop&pos=center-center&q=98&f=webp&c=2a7df858&v=6c4fc2ce636e105125115dc89335a4775500456be0fb0aee06526b084007cc3f)  ](https://www.lemonly.com/work/mongodb-indexing-fundamentals)  [MongoDB](https://www.lemonly.com/work?client=mongodb)[Data Indexing Fundamentals Explained](https://www.lemonly.com/work/mongodb-indexing-fundamentals)

 [Video](https://www.lemonly.com/work?category=video)
