Situatie
Instructions on how to migrate data stored in MongoDB to Azure Cosmos DB API for MongoDB.
Solutie
Migrate data by using mongoimport
To import data to your Azure Cosmos DB account, use the following template. Fill in host, username, and password with the values that are specific to your account.
Template
bash
mongoimport.exe –host <your_hostname>:10255 -u <your_username> -p <your_password> –db <your_database> –collection <your_collection> –ssl –sslAllowInvalidCertificates –type json –file “C:sample.json”
Example:
bash
mongoimport.exe –host cosmosdb-mongodb-account.documents.azure.com:10255 -u cosmosdb-mongodb-account -p <Your_MongoDB_password> –ssl –sslAllowInvalidCertificates –db sampleDB –collection sampleColl –type json –file “C:UsersadminDesktop*.json”
Migrate data by using mongorestore
To restore data to your API for MongoDB account, use the following template to execute the import. Fill in host, username, and password with the values that are specific to your account.
Template:
bash
mongorestore.exe –host <your_hostname>:10255 -u <your_username> -p <your_password> –db <your_database> –collection <your_collection> –ssl –sslAllowInvalidCertificates <path_to_backup>
Example:
bash
mongorestore.exe –host cosmosdb-mongodb-account.documents.azure.com:10255 -u cosmosdb-mongodb-account -p <Your_MongoDB_password> –ssl –sslAllowInvalidCertificates ./dumps/dump-2016-12-07
Leave A Comment?