mongodb-natural-language-querying

Solid

Generate read-only MongoDB queries (find) or aggregation pipelines using natural language, with collection schema context and sample documents. Use this skill whenever the user asks to write, create, or generate MongoDB queries, wants to filter/query/aggregate data in MongoDB, asks "how do I query...", needs help with query syntax, or discusses finding/filtering/grouping MongoDB documents. Also use for translating SQL-like requests to MongoDB syntax. Does NOT handle Atlas Search ($search operator), vector/semantic search ($vectorSearch operator), fuzzy matching, autocomplete indexes, or relevance scoring - use search-and-ai for those. Does NOT analyze or optimize existing queries - use mongodb-query-optimizer for that. Does NOT handle aggregation pipelines that involve write operations. Requires MongoDB MCP server.

API & Backend 729 stars 61 forks Updated 2 weeks ago Apache-2.0

Install

View on GitHub

Quality Score: 93/100

Stars 20%
95
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# MongoDB Natural Language Querying You are an expert MongoDB read-only query generator. When a user requests a MongoDB query or aggregation pipeline, follow these guidelines based on the Compass query generation patterns. ## Query Generation Process ### 1. Gather Context Using MCP Tools **Required Information:** - Database name and collection name (use `mcp__mongodb__list-databases` and `mcp__mongodb__list-collections` if not provided) - User's natural language description of the query - Current date context: ${currentDate} (for date-relative queries) **Fetch in this order:** 1. **Indexes** (for query optimization): ``` mcp__mongodb__collection-indexes({ database, collection }) ``` 2. **Schema** (for field validation): ``` mcp__mongodb__collection-schema({ database, collection, sampleSize: 50 }) ``` - Returns flattened schema with field names and types - Includes nested document structures and array fields 3. **Sample documents** (for understanding data patterns): ``` mcp__mongodb__find({ database, collection, limit: 4 }) ``` - Shows actual data values and formats - Reveals common patterns (enums, ranges, etc.) ### 2. Analyze Context and Validate Fields Before generating a query, always validate field names against the schema you fetched. MongoDB won't error on nonexistent field names - it will simply return no results or behave unexpectedly, making bugs hard to diagnose. By checking the schema first, you catch these issues be...

Details

Author
fcakyon
Repository
fcakyon/claude-codex-settings
Created
11 months ago
Last Updated
2 weeks ago
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

mongodb-search-and-ai

Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when users need to build search functionality for text-based queries (autocomplete, fuzzy matching, faceted search), semantic similarity (embeddings, RAG applications), or combined approaches. Also use when users need text containment, substring matching ('contains', 'includes', 'appears in'), case-insensitive or multi-field text search, or filtering across many fields with variable combinations. Provides workflows for selecting the right search type, creating indexes, constructing queries, and optimizing performance using the MongoDB MCP server.

729 Updated 2 weeks ago
fcakyon
API & Backend Solid

mongodb-query-optimizer

Help with MongoDB query optimization and indexing. Use only when the user asks for optimization or performance: "How do I optimize this query?", "How do I index this?", "Why is this query slow?", "Can you fix my slow queries?", "What are the slow queries on my cluster?", etc. Do not invoke for general MongoDB query writing unless user asks for performance or index help. Prefer indexing as optimization strategy. Use MongoDB MCP when available.

729 Updated 2 weeks ago
fcakyon
API & Backend Listed

sql-queries

Generate SQL queries from natural language descriptions. Supports BigQuery, PostgreSQL, MySQL, and other dialects. Reads database schemas from uploaded diagrams or documentation. Use when writing SQL, building data reports, exploring databases, or translating business questions into queries.

1 Updated 1 weeks ago
MARUCIE