Paste any SQL query and get the MongoDB equivalent instantly. Supports SELECT, INSERT, UPDATE, DELETE, GROUP BY, HAVING, LIKE, IN, IS NULL and more.
Cet outil vous aide à traduire vos requêtes SQL (Structured Query Language) standard en syntaxe de requête équivalente utilisée par MongoDB, une base de données documentaire NoSQL populaire. Il est conçu pour les développeurs en transition ou travaillant à la fois avec des bases de données relationnelles et MongoDB.
Entrez votre requête SQL dans la zone de saisie, et la requête MongoDB correspondante sera générée ci-dessous. Grâce à un analyseur SQL avancé, cet outil peut désormais gérer des requêtes plus complexes, y compris des agrégations de base et diverses clauses WHERE.
Opérations SQL Prises en Charge (Amélioré)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.