Loading DynamoDB to MongoDB Converter...
Please wait a moment

DynamoDB to MongoDB Converter Online — Convert DynamoDB Operations to MongoDB Queries

Paste your AWS DynamoDB params above and get the equivalent MongoDB query instantly. Converts FilterExpression, typed attribute values, and all CRUD operations — everything runs in your browser.

How to Convert DynamoDB to MongoDB — Step-by-Step

Step 1

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).

Paste directly: Copy the params object from your AWS Lambda, Node.js app, or AWS SDK code
Upload a file: Click "Upload" to select a .json or .js file
Load a sample: Click "Sample" to see a DynamoDB Scan with FilterExpression converted to MongoDB find()

Example: 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
}
Step 2

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:

Comparison operators: =, <>, <, >, <=, >= become MongoDB $eq, $ne, $lt, $gt, $lte, $gte
Functions: contains() becomes $regex, begins_with() becomes $regex: "^prefix", attribute_exists() becomes $exists
Typed values: {"S": "v"} extracts to "v", {"N": "42"} to 42, {"BOOL": true} to true
Logical operators: AND combines conditions in the filter, OR becomes $or, NOT becomes $not
BETWEEN: field 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)
Step 3

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.

PutItem: The entire Item object is unwrapped from DynamoDB types and passed to insertOne()
UpdateItem SET: SET #name = :val becomes { $set: { "name": val } }
UpdateItem REMOVE: REMOVE #field becomes { $unset: { "field": "" } }
UpdateItem ADD: ADD #counter :val (numeric) becomes { $inc: { "counter": val } }
DeleteItem: The 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
  }
)
Step 4

Copy or Download Your MongoDB Query

Copy to clipboard: Paste into MongoDB Compass, your mongosh shell, or application code
Download as file: Save as a .js file for version control or team sharing
Validate in Atlas: Run the output directly in the MongoDB Atlas data explorer to verify results
Try other converters: Go the other way with MongoDB to DynamoDB, convert to SQL, or format with the MongoDB Query Formatter

Frequently Asked Questions — DynamoDB to MongoDB

How do I convert DynamoDB to MongoDB online?

Paste your DynamoDB params JSON into the input editor and the converter generates the equivalent MongoDB query instantly. It handles Scan/Query (to find()), PutItem (to insertOne()), UpdateItem (to updateOne()), and DeleteItem (to deleteOne()). DynamoDB typed attribute values like {"S": "value"} and {"N": "42"} are automatically extracted into plain MongoDB values. No account or login needed — just paste and convert.

What DynamoDB functions does it convert?

contains(field, value) becomes MongoDB { field: { $regex: "value" } }. begins_with(field, prefix) becomes { field: { $regex: "^prefix" } }. attribute_exists(field) becomes { field: { $exists: true } } and attribute_not_exists() becomes { field: { $exists: false } }. The BETWEEN operator maps to { $gte: low, $lte: high }, and IN maps to $in. All standard comparison operators (=, <>, <, >, <=, >=) are converted to their MongoDB equivalents.

Does it handle UpdateItem with UpdateExpression?

Yes. The converter parses the full UpdateExpression syntax and maps each action to the appropriate MongoDB update operator. SET #name = :val becomes { $set: { "name": value } }. REMOVE #field becomes { $unset: { "field": "" } }. ADD #counter :incr on a numeric attribute becomes { $inc: { "counter": value } }, and ADD #tags :newTags on a set attribute becomes { $addToSet: { "tags": { $each: [...] } } }. Multiple actions in a single UpdateExpression are combined into one updateOne() call.

How are DynamoDB typed values handled?

DynamoDB stores every value with a type descriptor: {"S": "text"} for strings, {"N": "42"} for numbers (stored as strings in DynamoDB), {"BOOL": true} for booleans, {"NULL": true} for null values, {"L": [...]} for lists, and {"M": {...}} for maps. The converter extracts the underlying values automatically — {"N": "42"} becomes the number 42, nested maps and lists are recursively unwrapped, and set types (SS, NS, BS) become plain arrays.

Why migrate from DynamoDB to MongoDB?

Common reasons include needing more flexible querying — MongoDB supports ad-hoc queries on any field, JOINs via $lookup, and a rich aggregation pipeline. Teams also migrate to reduce vendor lock-in with AWS, gain a more expressive document model with nested queries, simplify local development (MongoDB runs easily on any machine), or move to a self-hosted or MongoDB Atlas setup for better cost control at scale.

Is my data safe?

Completely safe. Your DynamoDB params are processed entirely in your browser using client-side JavaScript. Nothing is transmitted to any server, no data is stored or logged, and no cookies are used for tracking your input. You can verify this by checking your browser's network tab — zero requests are made during conversion.

Is this converter free?

Yes, 100% free with no limits on usage, no account required, and no rate limiting. Use it as many times as you need for your DynamoDB to MongoDB migration. Also check out: SQL to MongoDB, MongoDB to SQL, SQL to DynamoDB, DynamoDB to SQL, and DynamoDB Query Formatter.