MongoDB Query Builder
Add conditions with a field, operator and value to build a MongoDB filter. The tool shows the filter as JSON and a runnable db.collection.find() string with optional projection, sort and limit.
How to build a MongoDB query
- Type your collection name, such as users.
- Add condition rows: choose a field, an operator like gt or in, and a value.
- Set an optional projection, sort and limit, then copy the filter or the find() query.
Examples
Find users older than 21, newest first
collection: users, age gt 21, sort age desc, limit 10
db.users.find({"age":{"$gt":21}}).sort({"age":-1}).limit(10)Match a role in a set
collection: users, role in admin,editor
db.users.find({"role":{"$in":["admin","editor"]}})Frequently asked questions
Which operators are supported?
Equality and inequality (eq, ne), comparisons (gt, gte, lt, lte), set membership (in, nin), pattern matching (regex) and field presence (exists). The eq operator collapses to a bare value, the rest map to $gt, $in, $regex and so on.
How do I write an $in list?
Use the in or nin operator and type comma-separated values, for example admin, editor. The tool splits them into an array and converts numbers and booleans automatically.
Can I add a projection, sort and limit?
Yes. Projection fields become a {field: 1} include object as the second find() argument, sort becomes .sort({field: 1 or -1}), and limit becomes .limit(n). Each part is only added when you fill it in.
What happens with two conditions on the same field?
Comparison operators on one field merge into a single object, so gte 18 and lt 65 on age become {age: {$gte: 18, $lt: 65}}, which is how you write a range query in MongoDB.
Are values treated as numbers or strings?
A value that looks like a number, true, false or null is converted to that type; anything else stays a string. This keeps the generated filter matching the JSON you would write by hand.
Is my query sent to a server or run against a database?
No. The builder only generates text. Everything runs in your browser, nothing is uploaded, and the tool never connects to any database.
Related tools
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
JSON Path Finder
Find and extract values from JSON by path. Paste JSON, type a path like $.users[0].name, and get the value. Lists every leaf path. Runs in your browser.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.
Base64 Decode
Decode Base64 to plain text online. Paste a Base64 or base64url string and get instant UTF-8 output. Free, fast and runs in your browser.