Build MongoDB queries with aggregation pipelines and operations. Part of the DevTools Surf developer suite. Browse more tools in the Database Tools collection.
Use Cases
Build $match, $group, $project, $lookup, and $unwind aggregation pipelines visually.
Generate find() queries with complex nested conditions without memorizing operator syntax.
Create index definitions for compound and partial indexes based on query patterns.
Use the aggregation pipeline builder for multi-stage queries — individual stages ($match, $group, $project) are clearer than embedding all logic in a single $where.
Add indexes on fields used in $match stages before running queries against large collections — a missing index on a 10M-document collection turns a 10ms query into a 30-second full scan.
Use $explain in the explain panel to verify the query planner chose the expected index and didn't fall back to a COLLSCAN.
Fun Facts
MongoDB's query language uses JSON-like syntax with operator prefixes ($eq, $gt, $in). This was deliberately designed to avoid SQL to appeal to developers who wanted a JSON-native data store.
MongoDB's aggregation pipeline, introduced in version 2.2 (2012), was modeled after Unix pipes — each stage transforms the document stream and passes it to the next, enabling complex queries without joins.
MongoDB was the fastest-growing database by adoption from 2014-2020, according to DB-Engines ranking. The MEAN (MongoDB, Express, Angular, Node.js) stack drove much of this adoption among JavaScript developers.
FAQ
Does it support MongoDB 6.x and 7.x operators?
Yes — the builder includes operators through MongoDB 7.0 including $setWindowFields, $densify, $fill, and $search (Atlas Search) pipeline stages.
Can I generate both find() and aggregate() queries?
Yes — simple queries build as find() with optional sort/limit; complex multi-stage operations use the aggregation pipeline builder and output aggregate() syntax.
Does it validate the query syntax?
Yes — operator types are validated (you can't use a string where a numeric operator expects a number) and required fields are checked before generating the query.