DynamoDB to MongoDB Converter Online — Convert DynamoDB Operations to MongoDB Queries
Paste your AWS DynamoDB params above and the matching MongoDB query appears next to them. Converts FilterExpression, typed attribute values, and all CRUD operations — everything runs in your browser.
How to Convert DynamoDB to MongoDB — Step-by-Step
Input Your DynamoDB Params
Migrating from DynamoDB to MongoDB? Paste the DynamoDB params JSON from your SDK code — the converter handles Scan, Query, PutItem, UpdateItem, and DeleteItem operations. The input expects the same JSON object you pass to the AWS DynamoDB SDK methods like documentClient.scan(params) or documentClient.put(params).
.json or .js fileExample: DynamoDB Scan Params
A typical Scan with FilterExpression, ExpressionAttributeNames, and typed ExpressionAttributeValues:
{ "TableName": "orders", "FilterExpression": "#status = :statusVal AND #total >= :minTotal", "ExpressionAttributeNames": { "#status": "status", "#total": "total_amount" }, "ExpressionAttributeValues": { ":statusVal": { "S": "completed" }, ":minTotal": { "N": "100" } }, "Limit": 20 }
Automatic Conversion to MongoDB
The converter maps DynamoDB concepts to their MongoDB equivalents. It parses FilterExpression syntax, resolves ExpressionAttributeNames (e.g., #status to status), and extracts DynamoDB typed values into plain MongoDB values:
=, <>, <, >, <=, >= become MongoDB $eq, $ne, $lt, $gt, $lte, $gtecontains() becomes $regex, begins_with() becomes $regex: "^prefix", attribute_exists() becomes $exists{"S": "v"} extracts to "v", {"N": "42"} to 42, {"BOOL": true} to trueAND combines conditions in the filter, OR becomes $or, NOT becomes $nor, and parentheses group conditions just as they do in DynamoDBfield BETWEEN :a AND :b becomes { field: { $gte: a, $lte: b } }Example: MongoDB find() Output
The Scan params from Step 1 convert to this MongoDB query:
db.orders.find( { "status": "completed", "total_amount": { "$gte": 100 } } ).limit(20)
CRUD Operation Mapping
Beyond read queries, the converter handles all DynamoDB write operations. PutItem becomes insertOne(), UpdateItem with UpdateExpression becomes updateOne() with $set/$unset/$inc, and DeleteItem becomes deleteOne(). Typed attribute values are unwrapped automatically in every case.
Item object is unwrapped from DynamoDB types and passed to insertOne()SET #name = :val becomes { $set: { "name": val } }REMOVE #field becomes { $unset: { "field": "" } }ADD #counter :val (numeric) becomes { $inc: { "counter": val } }Key is unwrapped and passed as the filter to deleteOne()Example: DynamoDB PutItem Input
A PutItem operation with typed attribute values:
{ "TableName": "users", "Item": { "userId": { "S": "u-1001" }, "name": { "S": "Alice Johnson" }, "age": { "N": "30" }, "active": { "BOOL": true } } }
Example: MongoDB insertOne() Output
Typed values are extracted and the document is ready for MongoDB:
db.users.insertOne( { "userId": "u-1001", "name": "Alice Johnson", "age": 30, "active": true } )
Copy or Download Your MongoDB Query
.js file for version control or team sharingFrequently Asked Questions — DynamoDB to MongoDB
What can I paste into the converter?
The params object you hand to Scan, Query, GetItem, PutItem, UpdateItem or DeleteItem, written as JSON. It can still sit inside your SDK code, such as new QueryCommand({ … }) or const params = { … };, and // or /* */ comments are skipped. Keys need double quotes, exactly as JSON wants them. Scan output pasted from the AWS CLI, with its "Items" list, becomes an insertMany() call. Batch requests, transactions and PartiQL statements are not converted; the page tells you so instead of guessing.
How are FilterExpression and KeyConditionExpression converted?
Both are read into one MongoDB filter. =, <>, <, <=, > and >= become plain matches or $ne, $lt, $lte, $gt and $gte. AND is applied before OR, as in DynamoDB, parentheses are respected, NOT becomes $nor, BETWEEN becomes $gte plus $lte and IN becomes $in. attribute_exists() and attribute_not_exists() turn into $exists, attribute_type() into $type, begins_with() into an anchored $regex and contains() on text into a case-sensitive $regex with special characters escaped. size() is written with $size. If a #name or :value is missing, or part of the expression can't be read, you get an error that names it rather than an empty filter that would match every document.
What happens to an UpdateExpression?
SET a = :v becomes $set, and SET a = a + :n (or minus) becomes $inc. list_append() becomes $push with $each, REMOVE becomes $unset, ADD on a number becomes $inc, ADD on a set becomes $addToSet with $each, and DELETE on a set becomes $pullAll. Because DynamoDB creates the item when the key does not exist, updateOne() gets { upsert: true }. A ConditionExpression is added to the filter instead, so the update only runs when it matches. Forms with no single MongoDB operator, such as copying one attribute into another or if_not_exists(), are listed in a note at the top of the output rather than dropped quietly.
Will long numbers like IDs stay exact?
Yes. DynamoDB keeps N values as text with up to 38 digits, and the converter never pushes them through a JavaScript number that would round them. A value a double holds exactly is written as a plain number, spelled as you typed it, so 14.50 stays 14.50. Other 64-bit integers, such as 8901240544102066246, become NumberLong("8901240544102066246"), and longer integers or decimals a double would round become NumberDecimal("…"). DynamoDB itself drops leading zeros from numbers, so N "00501" is written as 501 with a note; store values like ZIP codes as S strings if the zeros matter.
How are the other DynamoDB types handled?
S becomes a string, BOOL a boolean and NULL a null. M turns into a nested document and L into an array, and both are unwrapped all the way down. SS and NS sets become arrays, and B and BS binary values become BinData(0, "…") with the Base64 kept as it was. Plain values from the DocumentClient, such as "age": 30 instead of {"N": "30"}, work too.
Will a request with only a Key turn into a delete?
Only when it doesn't look like a read. If the code calls GetItemCommand or .get(), or the params have ConsistentRead or a ProjectionExpression, you get findOne(). A bare Key with nothing else is read as DeleteItem and becomes deleteOne(), with a note at the top that points to findOne() in case you meant a GetItem. Check that line before you run the script.
Why move from DynamoDB to MongoDB?
Teams usually move for querying: MongoDB can filter on any field without planning indexes up front, join collections with $lookup and run aggregation pipelines. Others want to step away from a single cloud vendor, run the database locally during development, or move to self-hosted MongoDB or MongoDB Atlas to control costs at scale.
Are my DynamoDB params uploaded anywhere?
No. The conversion runs in your browser with JavaScript, and nothing you paste is sent to a server or kept. Reload the page and the editor starts empty again.
Related converters: SQL to MongoDB · MongoDB to SQL · SQL to DynamoDB · DynamoDB to SQL · DynamoDB Query Formatter
Related Tools
SQL to MongoDB
Convert SQL queries to MongoDB query syntax with aggregation pipeline support
MongoDB to SQL
Convert MongoDB queries and aggregation pipelines to equivalent SQL statements
SQL to DynamoDB
Convert SQL queries to AWS DynamoDB query and scan operations with PartiQL support
DynamoDB to SQL
Convert AWS DynamoDB query and scan operations to equivalent SQL statements
MongoDB Query Formatter
Format, beautify, and validate MongoDB queries with proper indentation and syntax highlighting
MongoDB to DynamoDB
Convert MongoDB queries to AWS DynamoDB query operations and vice versa