SQL to MongoDB
Turn SELECT statements into MongoDB find() queries, in your browser.
How to use it
- Paste a SELECT statement into the left panel.
- The converter reads the SELECT list, FROM, WHERE, ORDER BY, LIMIT and OFFSET clauses.
- The right panel shows the equivalent MongoDB shell call: db.collection.find(filter[, projection]).sort().skip().limit().
- Read the notes line under the panels — it records every adjustment, such as LIKE becoming an anchored regex.
- Copy the query into mongosh, Compass or your driver code.
Common use cases
- Moving from SQL to MongoDB — translate reporting queries while you port an application.
- Writing find() by hand less often — paste the SQL your team already knows and read the filter document.
- Checking filter semantics — see how SQL operators map to $gt, $lt, $ne, $in and $regex before you commit to a schema.
- Counting rows — COUNT(*) becomes countDocuments with the same filter, not a separate hand-written query.
Why it stays private
The whole conversion runs in your browser's memory. Query text often contains table names, field names and sample data from production, and none of it is uploaded.
FAQ
Q: What happens with JOIN, GROUP BY or HAVING? A: The converter stops with an error that names the clause and the reason: find() cannot join or group. Those operations live in the aggregation pipeline ($lookup, $group, $match), and the error message says so instead of producing a query that would silently return the wrong thing.
Q: How is LIKE translated? A: Into an anchored $regex: % becomes .*, _ becomes ., and every other character is escaped. Because SQL LIKE is case-insensitive on some engines but MongoDB regex is case-sensitive by default, add the i option in mongosh when your collation depends on it.
Q: Does it handle AND and OR precedence? A: Yes. AND binds tighter than OR, and parentheses are respected, so the filter tree matches the SQL grouping. The output uses explicit $and and $or arrays wherever more than one condition applies, which keeps the structure visible.
Your data stays on this device
SQL to MongoDB runs 100% locally. Everything you paste or drop is processed by your own browser and never transmitted. Nothing is stored on our servers — close the tab and it is gone.
Nothing you type is sent to a server, logged, or used for analytics. The page works even with your network disconnected after first load.