Mongorestore Documentdb May 2026

mongorestore --host ... --gzip --db mydb /dump/gzipped/ DocumentDB handles decompressed BSON correctly; no special handling is required. Assume you have a MongoDB Atlas dump compressed with gzip:

mongorestore --host <documentdb-cluster-endpoint> \ --port 27017 \ --username <username> \ --password <password> \ --authenticationDatabase admin \ --ssl \ --sslAllowInvalidHostnames \ --db target_db \ /path/to/backup/dump Because DocumentDB requires TLS/SSL connections, you must always include --ssl . The --sslAllowInvalidHostnames flag is often necessary due to the way DocumentDB’s routing endpoint presents certificates. 1. Authentication and Authorization DocumentDB uses SCRAM (default) or AWS IAM authentication. For SCRAM, pass --username and --password . For IAM, you need a separate plugin ( --authenticationMechanism MONGODB-AWS ) — available in mongorestore version 4.4+. mongorestore documentdb

Use --drop carefully. DocumentDB supports it, but if you drop a large collection, the cluster may take time to reclaim storage. Prefer restoring into a new database when possible. mongorestore --host

Amazon DocumentDB (with MongoDB compatibility) is a fast, scalable, fully managed database service that mimics the MongoDB 4.0 and 5.0 wire protocols. While it aims to be a drop-in replacement for MongoDB, subtle differences exist. One of the most common migration and backup-recovery tasks is restoring data using mongorestore — the standard utility from MongoDB’s database tools. This essay explores how to effectively use mongorestore with DocumentDB, highlighting compatibility nuances, operational steps, and performance considerations. Understanding the Compatibility Layer DocumentDB implements the MongoDB wire protocol but not its internal storage engine. As a result, most mongorestore operations work seamlessly for BSON dumps created by mongodump . However, DocumentDB does not support all MongoDB features (e.g., multi-document ACID transactions across shards, certain aggregation operators, or $regex with specific options). When preparing to run mongorestore against DocumentDB, you must ensure that the source BSON files do not rely on unsupported features; otherwise, the restore may fail silently or skip documents. Basic Usage Pattern The syntax for mongorestore against DocumentDB is identical to that for MongoDB: For SCRAM, pass --username and --password