menu

A coed, independent, Episcopal day school in Tampa, Florida, educating students in pre-k through twelfth grade

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

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: Use --drop carefully