Paste any SQL query and get the MongoDB equivalent instantly. Supports SELECT, INSERT, UPDATE, DELETE, GROUP BY, HAVING, LIKE, IN, IS NULL and more.
Questo strumento ti aiuta a tradurre le tue query SQL (Structured Query Language) standard nella sintassi di query equivalente usata da MongoDB, un popolare database documentale NoSQL. È progettato per sviluppatori in transizione o che lavorano sia con database relazionali che con MongoDB.
Inserisci la tua query SQL nell'area di input e la query MongoDB corrispondente verrà generata di seguito. Grazie a un parser SQL avanzato, questo strumento può ora gestire query più complesse, incluse aggregazioni di base e clausole WHERE variegate.
Operazioni SQL Supportate (Avanzate)Translates column selection and WHERE conditions into a MongoDB find() call with query filter and projection.
ORDER BY becomes sort(), LIMIT becomes limit(), OFFSET becomes skip().
GROUP BY with aggregate functions (COUNT, SUM, AVG, MIN, MAX) is translated into a MongoDB aggregation pipeline.
HAVING filters are translated into a second $match stage in the aggregation pipeline, applied after grouping.
SQL LIKE patterns with % (any characters) and _ (single character) are converted to MongoDB regular expressions.
Full support for IN/$in, NOT IN/$nin, IS NULL/{$eq:null}, IS NOT NULL/{$ne:null}, AND/$and, OR/$or.
Single-row INSERT becomes insertOne(). Multi-row INSERT becomes insertMany(). Column names become document field names.
SQL SET clauses become MongoDB $set operators. The WHERE condition becomes the filter document.
DELETE FROM with a WHERE condition becomes deleteMany(). Use with care — no WHERE deletes all documents.
| SQL Operator | MongoDB Operator | Notes |
|---|---|---|
| = | $eq (or implicit) | Exact match |
| != / <> | $ne | Not equal |
| > | $gt | Greater than |
| >= | $gte | Greater than or equal |
| < | $lt | Less than |
| <= | $lte | Less than or equal |
| IN (...) | $in | Value in list |
| NOT IN (...) | $nin | Value not in list |
| LIKE '%x%' | $regex: /.*x.*/ | % → .*, _ → . |
| NOT LIKE | $not: /pattern/ | Negated regex |
| IS NULL | field: null | Includes missing fields |
| IS NOT NULL | $ne: null | Field exists and is not null |
| AND | $and | All conditions must match |
| OR | $or | Any condition must match |
| COUNT(*) | $sum: 1 | In $group stage |
| SUM(f) | $sum: "$f" | In $group stage |
| AVG(f) | $avg: "$f" | In $group stage |
| MIN(f) | $min: "$f" | In $group stage |
| MAX(f) | $max: "$f" | In $group stage |
| ORDER BY ASC | sort({ f: 1 }) | Ascending |
| ORDER BY DESC | sort({ f: -1 }) | Descending |
| LIMIT n | limit(n) | |
| OFFSET n | skip(n) |
Moving from MySQL, PostgreSQL or SQLite to MongoDB? This tool helps you translate your existing query logic quickly and accurately, reducing the risk of errors during migration.
If you know SQL, this converter shows you exactly how each SQL concept maps to MongoDB's document model — making it the fastest way to learn MongoDB query syntax.
Even experienced MongoDB developers sometimes think in SQL first. Use this tool as a quick reference to translate your mental model into the correct MongoDB syntax.
Share converted queries with teammates who come from a SQL background. A common language reduces friction when working across different database ecosystems.