SQL to MongoDB query
Convert a SQL SELECT statement into a MongoDB find() call or aggregation pipeline.
SQL to MongoDB query
Paste a SQL SELECT statement and this tool converts it into the equivalent MongoDB query — either a mongosh method call you can run in the shell, or a plain JSON query document for your own driver code. It reads the WHERE clause, ORDER BY, LIMIT and OFFSET and turns them into a MongoDB filter, sort, limit and skip, so "SELECT id, name FROM users WHERE age > 18 ORDER BY name DESC LIMIT 10" becomes a ready-to-run find() with the matching filter and sort objects.
It also understands aggregation. COUNT, SUM, AVG, MIN and MAX in the SELECT list combined with GROUP BY produce a $group stage followed by a $project stage that renames the grouped _id fields back to their original columns. A JOIN becomes a $lookup plus $unwind stage when "Convert JOIN to $lookup" is on — turn it off and the join is dropped instead, with a note explaining why. "Convert column names to camelCase" reshapes snake_case columns like first_name into firstName, matching typical Mongoose naming, and the indentation is yours to set.
Not every SQL construct has a clean MongoDB equivalent — subqueries, UNION, CASE expressions and HAVING don't map onto a single query or pipeline. Rather than silently producing a wrong query, the tool reports a clear error naming the unsupported construct, or, for things it can work around (an extra JOIN, a dropped HAVING, an ungrouped SELECT column), adds a short warning comment above the generated query explaining what changed.
Everything runs locally in your browser: the SQL is parsed and converted entirely on your device, and no query or schema ever leaves it. Copy the result, download it as a .txt file, or send it back into the input to keep refining the original query.