liveBook · Manning

Schema suggestion

As explained in MongoDB 8.0 in Action, Third Edition

A schema suggestion is a proposed change to field structure, indexes, or data types based on observed collection traffic and query behavior.

A schema suggestion is an Atlas recommendation for changing field structure, indexes, or data types after analyzing collection traffic, slow queries, and sampled documents. It turns observed bottlenecks into targeted data-modeling improvements. section 21.2.2

Schema suggestions commonly address:

  • Restructuring deeply nested fields or excessive arrays to reduce query complexity. section 21.2.2
  • Normalizing fields whose data types or sizes vary widely, improving query performance and storage efficiency. section 21.2.2
  • Adding indexes for frequently filtered fields or adjusting field arrangements to improve query execution plans. section 21.2.2
  • Adapting recommendations as workloads, traffic patterns, and data structures evolve. section 21.2.2

Applying a suggestion

When a high-traffic collection contains slow queries filtering on a field without a suitable index, Atlas can recommend adding an index for that field. Review the recommendation in the Atlas UI, then implement it when it fits the application’s access pattern. section 21.2.2

Schema suggestions work alongside Query Profiler, Namespace Insights, and other monitoring tools: diagnostics reveal latency and bottlenecks, while recommendations propose changes to the underlying data model. section 21.5

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Analyzes sampled documents and query patterns, recommends structural changes, and stops short of command-level implementation detail.
Examples
Uses nested fields, excessive arrays, inconsistent data types, slow queries, and frequently filtered unindexed fields as diagnostic cases.
What it assumes
Assumes observable collection traffic, query behavior, document structure, and slow-query activity.
What you can do after
Evaluate and implement Atlas recommendations for restructuring fields, optimizing indexes, and adjusting data types.
How it connects
Connects Performance Advisor, Query Profiler, indexes, field structure, data types, and query execution plans.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.