# How to structure your MongoDB data for speed

Canonical: https://brew.new/templates/mongodb/how-to-structure-your-mongodb-data-for-speed

Brand: mongodb.com
Category: newsletter

![Preview of How to structure your MongoDB data for speed](https://cdn.brew.new/email-preview-3f84234afbba2ec9-tracking_r57v573skdq02bdr7edjehac598exf4k-1790115690077.png)

## Email content

Hi there,

The inherent flexibility of MongoDB's document model makes the initial setup easy. However, the performance and scalability of your application depend significantly on how you structure your data.

Log in

Data modeling for high performance

In MongoDB, you can model data in JSON the same way you do in code, as intuitive objects. Unlike in relational approaches, optimizing for performance in MongoDB follows a few simple guidelines.

When to embed data: Data that is accessed together should be stored together. For "one-to-few" relationships (like a user and their shipping addresses), embedding the addresses inside the user document is ideal. This improves query performance and enables low-latency performance at scale.

Reference data with one-to-many relationships: For "one-to-many" relationships (like a product and its thousands of customer reviews), you should use references. Instead of embedding all reviews in the product document, you would store a product_id reference in a separate reviews collection.

Avoid unbounded arrays: Embedding thousands of reviews in a single product document creates a massive document that must be loaded into memory. This can hurt performance and risks hitting the 16MB document size limit. If an array's size is "unbounded" (it can grow indefinitely), it should be a separate collection and referenced.

Refine your data model

Here's a simple workflow for designing your schema:

Agent Skills: Provide expert instructions that apply MongoDB best practices to AI coding agents. Use the Schema Design skill to structure documents correctly, avoid over-normalization, and optimize for performance from the start. Install the plugin in your preferred AI tool (like Cursor, Claude Code, Gemini CLI, or VS Code).

Explore visually: Connect to your cluster with MongoDB Compass to visually explore, query, and refine your schema as you build.

Map your queries: Think about what data your application needs to display on a single screen. That data is a great candidate to be "stored together" in a single document.

Log in

FOLLOW FOR MORE

LinkedIn Twitter MongoDB Docs Page Youtube Reddit Stack Overflow

Copyright © 2026 MongoDB, All rights reserved.

1633 Broadway Floor 38, New York, NY 10019

view in browser or unsubscribe

[Open and remix this design](https://brew.new/templates/mongodb/how-to-structure-your-mongodb-data-for-speed)

[Browse email designs](https://brew.new/browse/templates)
