For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

Designing Your Schema

The schema design process helps you identify the data your application needs and organize it to optimize performance.

Plan and design your schema early in the development process. This helps prevent performance issues as your application grows.

MongoDB's flexible schema lets you evolve your data model iteratively. You can add new fields and new content types without rewriting existing documents or migrating data. Depending on your application, you may want to establish a simple schema to cover basic functionality before optimizing.

The schema design process consists of the following steps:

1

Identify the operations that your application runs most frequently. See Identify Application Workload.

2

Identify the relationships in your application's data and decide whether to link or embed related data. See Map Schema Relationships.

3

Apply schema design patterns to optimize reads and writes. See Apply Design Patterns.

4

Create indexes to support common query patterns. See Create Indexes to Support Your Queries.