MongoDB Query Builder
Build MongoDB queries visually and watch them render live. Switch between Find mode (field/operator/value conditions, projection, sort, limit, skip) and an Aggregate pipeline builder ($match, $group, $sort, $project, $limit, $skip, $unwind, $lookup). The exact same query is emitted for four targets at once - the Mongo shell, the Node.js driver, Mongoose, and Python's pymongo - so you can copy whichever your stack uses. Everything runs in your browser; no database is contacted.
About this ToolHow it works, benefits & use casesTap to collapse
Build MongoDB queries visually from structured inputs and watch them render live, then copy the exact same query for whichever driver your stack uses. Two modes cover the bulk of day-to-day querying. Find mode lets you stack filter conditions as field + operator + value rows - $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $regex, and $exists - and add a projection (comma-separated fields), a sort (field:1 or field:-1), a limit, and a skip; the builder composes a chained db.collection.find({...}).sort({...}).skip(n).limit(n) call. Aggregate mode is a full pipeline builder where you add and reorder stages - $match, $group (with $sum, $avg, $min, $max, and $count accumulators), $sort, $project, $limit, $skip, $unwind, and $lookup - to assemble a pipeline array. Whatever you build is emitted simultaneously for four targets: the Mongo shell, the Node.js driver, Mongoose, and Python pymongo, so the right syntax is one dropdown away. Values are coerced for you - 42 becomes a number, true/false booleans, null a null, and $in/$nin take a comma-separated list. Start from a template, then copy, download, or share the result via URL. Everything runs in your browser and no database is ever contacted.
How to Use
- 1Enter the collection name and choose a mode - Find or Aggregate.
- 2In Find mode, add filter conditions (field, operator, value), then optionally set projection fields, a sort, a limit, and a skip.
- 3In Aggregate mode, add pipeline stages such as $match, $group, $sort, $project, $limit, $skip, $unwind, or $lookup and fill in each stage.
- 4Pick an output target - Mongo shell, Node.js driver, Mongoose, or pymongo - to render the same query in that syntax.
- 5Copy the query, download it, or share the URL; load a template for a ready-made starting point.
Key Benefits
- Two modes: a Find builder and a full Aggregate pipeline builder
- Ten filter operators including $in, $nin, $regex, and $exists
- Aggregate stages: $match, $group, $sort, $project, $limit, $skip, $unwind, $lookup
- Group accumulators: $sum, $avg, $min, $max, and $count
- The same query emitted for the Mongo shell, Node.js driver, Mongoose, and pymongo
- Automatic value coercion for numbers, booleans, null, and comma-separated arrays
- Live output, ready-made templates, and a fully shareable URL
- Runs entirely in your browser - no database connection
Common Use Cases
- Drafting a find() with a filter, projection, sort, and paging without syntax slips
- Assembling an aggregation pipeline with a $match, $group, and $sort from scratch
- Translating a query you wrote in the shell into Node.js, Mongoose, or pymongo syntax
- Looking up the correct shape for $in array queries, $regex, or $lookup joins
- Sharing a reproducible query with a teammate as a single link
The same query rendered for your chosen driver
db.users.find({
status: "active"
})Collection
Filter conditions
Projection & ordering
Comma-separated field names to include
field:1 (asc) or field:-1 (desc), comma-separated
A limit or skip of 0 is omitted from the query.
One query, four drivers
The structured inputs are rendered to the same query for the Mongo shell, the Node.js driver, Mongoose, and pymongo. Switch the output target and copy whichever your stack uses.
Smart value coercion
Values are coerced automatically: 42 becomes a number, true/false booleans, null a null, and $in/$nin accept a comma-separated list.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- JSON FormatterFormat and validate JSON with syntax highlighting
- JSON Path FinderFind and test JSON paths
- Find and ReplaceFind and replace text with support for regex
- GraphQL Query BuilderBuild GraphQL queries and mutations visually
- Query String BuilderBuild and encode URL query strings
- SQL to NoSQL ConverterConvert SQL SELECT/INSERT/UPDATE/DELETE to MongoDB find queries or aggregation pipelines, with output for the Mongo shell, Node.js driver, or Mongoose and a clause-by-clause mapping
Find mode builds a single db.collection.find() call: you stack field/operator/value conditions and add an optional projection, sort, limit, and skip. Aggregate mode builds a pipeline array passed to aggregate(), where each stage ($match, $group, $sort, $project, $limit, $skip, $unwind, $lookup) is a step the documents flow through in order. Use Find for straightforward filtering and Aggregate when you need grouping, joins, or multi-step transforms.
Four, all from the same structured input: the Mongo shell (db.collection.find / aggregate), the Node.js driver (db.collection("name").find(...)), Mongoose (Model.find(...).select(...)), and Python pymongo (db["name"].find(...).sort([...])). Switch the output target dropdown and the identical query is re-rendered in that driver's idiom - sort, skip, and limit are chained the way each one expects.

