Most MongoDB slowdowns ship in a release. A new query filters on a field nobody indexed, works fine on a laptop with a thousand documents, and scans three million in production. Meanwhile, indexes from features long gone still slow down every write. Nobody meant for either to happen. Nobody looked.
A short index review before each release fixes that. The author lists the new queries, the AI explains each one against the real collection, and the team decides what to add, hide or drop. Creating and dropping indexes stays with people.
Here's who does what, three prompts, and how a delivery app reviews release 4.13.
Who does what
Who does what
What to check
- New queries. Does each one use an index, or scan the collection? Compare documents examined with documents returned.
- Index order. Compound indexes work best in equality, sort, range order.
- Unused indexes. Every index costs writes and storage. Hide before you drop.
- Redundant indexes. An index that's a prefix of another is usually no longer needed.
Start with MongoDB's own tools
On Atlas, Performance Advisor suggests indexes from slow queries and flags unused and redundant ones, on M10 and larger clusters. explain shows any query's plan, and $indexStats shows how often each index is used.
What's left is doing it before the release, not after, with the people who'll own the change.
Do it in Claude or ChatGPT
Connect MongoDB with our guide to MongoDB in Claude, ChatGPT and MCP, read-only. The first two prompts only read. The third only suggests.
Explain the new queries.
Using MongoDB, explain these queries from the release: [paste queries]. For each, say whether it uses an index or scans the collection, and how many documents it examines against how many it returns. Don't change anything.
Copy promptUnused and redundant indexes.
List the indexes on [collection] with their usage from $indexStats, and flag any that look unused or are a prefix of another index. Remember the counters reset when a server restarts. Don't change anything.
Copy promptDesign the index.
Suggest an index for this query, following MongoDB's equality, sort, range rule: [paste query]. Say what it adds to write cost, and whether an existing index could be extended instead.
Copy promptA few things to know:
- Explain against production data. A query that's fast on a test database can scan millions in production.
- Unused isn't always safe. Counters reset on restart, and a monthly report may need an index nobody used this week.
- Hide, then drop. A hidden index can come back in seconds. A dropped one takes a rebuild.
- Build in a quiet window. Heavy writes slow an index build.
When the backend team ships together
On your own, you'd check your own queries. In a team, Hollis writes the feature, Sasha reviews it, Blake is on call the night it ships, and a missing index becomes everyone's problem at 2am.
Sparrowhawk, a 45-person grocery delivery app in Nashville, reviews indexes in BlueNexus. MongoDB is connected. Every Thursday at 14:00, before the next Tuesday release, the schema agent checks the new queries Hollis listed against the orders collection and its indexes, and prepares the review for Sasha.
Illustration of the BlueNexus app with example data.
Illustration of the BlueNexus app with example data.
One new query has no index and would scan three million orders. One old index served a report that's gone, and another becomes redundant once the new one exists. The agent prepares the next steps for Sasha.
Sasha approves. Hollis adds the index to the migration on Friday, and Blake schedules the build for Monday night. Sasha hides the old region index and sets a reminder to drop it in a week.
For Sasha, the backend lead. From MongoDB. Nothing is posted or changed until Sasha approves it.
- Post the review in the release threadTwo queries, the indexes they use, and the indexes to add and retire
- Create a task for Hollis to add the courier index in the migrationIn the Backend project: courierId, status, createdAt
- Ask Blake to schedule the index build for Monday nightIn the on-call channel, before Tuesday's release
- Hide legacy_region_1Left unticked: Sasha hides it for a week, then drops it
Illustration of the BlueNexus app with example data.
For connecting MongoDB, see MongoDB in Claude, ChatGPT and MCP. For schemas, see how to find schema drift in MongoDB. To review releases with your team, sign up for BlueNexus.