MongoDB Query Builder
Build find filters or aggregate pipelines from visual rows — field, operator, value
Query Builder
Matches values equal to the specified value. Shorthand: { field: value }.
Examples
Age range with AND
age $gte 18 AND age $lt 65{ "$and": [ { "age": { "$gte": 18 } }, { "age": { "$lt": 65 } } ] }Two numeric comparisons combined with AND logic.
Count by department
status = active, group by department, sort count DESC, limit 10Pipeline: $match → $group → $sort → $limitAggregate mode groups matched documents and ranks departments by count.
About this tool
MongoDB queries are JSON — find filters, projection documents, and aggregate pipeline stages. Writing them by hand means remembering operator names ($gte, $in, $regex), BSON types, and how AND/OR logic nests in $and and $or arrays.
This builder turns visual filter rows (field, operator, value) into copy-ready find JSON or an aggregate pipeline. Choose find mode for filter/projection/sort/limit, or aggregate mode for $match, optional $group by field, $sort, and $limit. Toggle shell output for db.collection.find() syntax. Everything runs in your browser — no database connection.
How to use
Set collection
Enter the collection name used in shell output (e.g. users).
Add filters
Click Add filter, set field, operator, and value. Combine rows with AND or OR.
Pick output mode
Find emits a filter document; Aggregate builds a pipeline with $match and optional $group.
Copy output
Copy JSON or toggle Shell for mongo shell syntax.
Use cases
Draft find queries
Prototype filters before pasting into Compass, Studio 3T, or application code.
Learn operators
Each operator shows inline help text explaining $in, $regex, $exists, and more.
Aggregate reports
Build $match + $group pipelines for simple analytics without writing JSON by hand.
Common mistakes
Mistake:Using string type for numeric comparisons.
Fix:Set value type to number for $gt, $gte, $lt, and $lte so BSON types match your schema.
Mistake:Forgetting $group in aggregate mode.
Fix:Add a group-by field or the pipeline only filters — no aggregation stage is emitted without it.
Frequently asked questions
Related guides
References & standards
Related tools
Base64 Toolbox
Professional Base64 workspace for text, files and images with Base64URL, MIME, Data URI, strict validation, image preview and ready-to-use snippets.
C# to VB.NET Converter
Convert a subset of C# — classes, methods, variables, loops — into VB.NET
CSV Data Viewer
Paste CSV and browse rows in a sortable table with delimiter detection
CSV to Chart
Paste or upload CSV data and generate bar, line, pie, or doughnut charts. Export as PNG.
CSV to JSON Converter
Paste CSV data and convert it to pretty-printed JSON instantly — supports custom delimiters, header row toggling, and value trimming.
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV