suggest_mongo_index
Generates MongoDB createIndex command for a field, including compound and text variants, plus an explain query to verify index usage. Use when a collection scan is detected or when filtering on an unindexed field.
Instructions
Generates the exact db.collection.createIndex() command for a MongoDB field, plus compound and text index variants and an explain query to verify. Call this when a collection scan is flagged by the analyzer or when writing a query that filters on an unindexed field. Does not check whether the index already exists.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | MongoDB collection name | |
| field | Yes | Field name to index |