Draft an aggregation pipeline
If you ask
“Write an aggregation to count orders per customer, sorted by total spend descending, top 10”
Then
Let AI write complex aggregation pipelines based on what you want to know.
Works in Claude, Codex, Cursor & any MCP agent
How this prompt works
-
Turn on the MongoDB connector in Claude, ChatGPT or Cursor — once.
-
Paste the prompt above. No code, no menus.
-
Let AI write complex aggregation pipelines based on what you want to know.
Level up: install the MongoDB skill
A prompt you paste once. A skill your agent keeps — playbooks and defaults it loads every session. Official pack.
npx skills add mongodb/agent-skills FAQ
How do I draft an aggregation pipeline with MongoDB?
Add the MongoDB MCP connector once, then paste this prompt into Claude or ChatGPT: "Write an aggregation to count orders per customer, sorted by total spend descending, top 10". Your AI runs it in MongoDB.
Do I need to code?
No. You install the connector once (a short config or one click), then ask in plain words. The prompt on this page works as-is.
Which AI assistants work?
Claude (Desktop, Code), Cursor, ChatGPT and other MCP clients. The same prompt works across them.
Set up MongoDB in Claude
Copy-paste config, setup steps and more ready-to-run prompts on the connector page.
Open MongoDB setupMore prompts