mongodb-query-optimizer

Analyze MongoDB queries and index configurations using explain plans and Atlas Performance Advisor.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/re-sohail/e-commerce --skill mongodb-query-optimizer-re-sohail
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mongodb-query-optimizer
Source: https://github.com/re-sohail/e-commerce/tree/main/.agents/skills/mongodb-query-optimizer
Command: npx skills add https://github.com/re-sohail/e-commerce --skill mongodb-query-optimizer-re-sohail

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps developers and DB administrators identify and fix performance issues in MongoDB queries by providing index recommendations and insights from MongoDB MCP tools or Atlas Performance Advisor.

Core Features & Use Cases

  • Performance analysis: Retrieves collection indexes, runs explain plans, and fetches slow‑query logs.
  • Index recommendations: Suggests optimal compound indexes based on query shape and execution stats.
  • Atlas integration: Uses Performance Advisor data when Atlas API credentials are available.
  • Reference guidance: Loads core indexing principles and antipattern examples to explain suggestions.

Quick Start

Ask the optimizer to review a slow query such as db.orders.find({status:'shipped'}).sort({date:-1}) and receive index recommendations.

Frequently Asked Questions about mongodb-query-optimizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get index recommendations for slow MongoDB queries?

To get index recommendations for slow MongoDB queries, you provide the query shape to the optimizer, which analyzes execution stats and suggests optimal compound indexes to improve performance.

What is the best way to analyze MongoDB query performance using an explain plan?

Analyzing MongoDB query performance involves running an explain plan to retrieve collection indexes and evaluate execution statistics, allowing the optimizer to identify bottlenecks and suggest optimal index configurations.

Do I need a MongoDB MCP server to run slow-query diagnostics?

Yes, you need a configured MongoDB MCP server or Atlas API credentials to run slow-query diagnostics, as the optimizer requires access to execute explain, find, and performance-advisor operations.

Can I use Atlas Performance Advisor data to fix slow MongoDB queries?

Yes, you can use Atlas Performance Advisor data to fix slow MongoDB queries by providing Atlas API credentials, which allows the optimizer to fetch slow-query logs and generate targeted index recommendations.

How does the optimizer handle compound index suggestions for complex query shapes?

The optimizer handles compound index suggestions by evaluating the specific query shape against execution statistics and applying core indexing principles to propose the most effective multi-field index configuration.

What are the limitations of using MongoDB MCP tools for query optimization?

The primary limitation is the strict dependency on a pre-configured MongoDB MCP server or valid Atlas API credentials, as the optimizer cannot run collection-indexes or explain operations without this external access.