sitekits.dev
press ⌘K to switch tools
FORMAT & CONVERT

SQL to MongoDB Query Converter

Convert SQL queries to MongoDB query syntax.

local
sql-mongo
§01 ABOUT THIS TOOL

Overview

A quick translator for developers moving between relational and MongoDB syntax. It parses a simple SELECT statement and emits the equivalent db.collection.find() call: the column list becomes a projection, WHERE becomes the filter document, ORDER BY becomes .sort() (with DESC-1), and LIMIT becomes .limit().

How to use

  1. Type or paste a query into the SQL SELECT area.
  2. Read the translated query from the MongoDB output, which updates as you type.

Examples

  • SELECT name, age FROM users WHERE age > 18 ORDER BY name LIMIT 10db.users.find({"age":{"$gt":18}}, {"name":1,"age":1}).sort({"name":1}).limit(10)
  • SELECT * FROM orders WHERE status = 'paid'db.orders.find({"status":"paid"})

Notes

This handles basic query shapes only — it is a syntax aide, not a full SQL parser. Multiple WHERE conditions are combined with AND semantics (MongoDB’s implicit conjunction); string values may be single- or double-quoted, and unquoted values are treated as numbers. Verify translated queries against your data before relying on them.

FAQ
Are my queries sent to a server?
No. The SQL is parsed and translated entirely in your browser. Nothing is transmitted, so queries referencing real table or field names stay private.
Which SQL statements are supported?
Only a single SELECT of the form SELECT ... FROM ... [WHERE] [ORDER BY] [LIMIT]. WHERE conditions must be joined with AND; OR, JOIN, GROUP BY, subqueries, IN, and LIKE are not supported.
How are comparison operators translated?
Equality becomes a direct value match; the operators >, <, >=, <=, and != (or <>) map to $gt, $lt, $gte, $lte, and $ne respectively.