Exporting data from Azure DocumentDB

40.5k views Asked by At

is there an option in Azure to export an existing collection from DocumentDB?

I could only seen an Import option.

4

There are 4 answers

3
David Makogon On BEST ANSWER

There is no built-in export option in the database service itself. However, the DocumentDB Data Migration Tool, published by the DocumentDB team, is available and provides both import and export capabilities (export is to JSON). Everything is documented on the DocumentDB area of the Azure site, specifically here.

This isn't your only option, as you can write your own export app based on one of the existing language SDKs or direct REST API calls.

There may be other tools available, but getting into a which is the best tool for this discussion is off-topic. I'm only pointing out the Data Migration tool because the DocumentDB team provides it, along with official documentation.

0
PotatoFarmer On

Surprisingly, as of ~mid-2017 there still not does not appear to be a simple "Download DB" and "Upload DB" type functionality for Azure CosmosDB (previously known as DocumentDB). Here is one option:

Caveat: Below method does not appear to support exporting attachments. If that is something you need, this might not work for you.

Export locally to a JSON file

Use the Azure DocumentDB Data Migration Tool to export and import DocumentDB collections.

In Source Information Page:

  1. Select DocumentDB as source
  2. In connection string, provide the connection string from the Azure Portal.
  • Format is: AccountEndpoint=http://blah.documentdb.com/;AccountKey=blahblah;Database=dbname To export, select "JSON file" as target and your documentDB as source
  1. Ensure Database valid exists in connection string, if not, append it.
  • Click Verify to ensure your connection works.
  1. Enter a valid collection name in the collection field.

sourceinformationpage


In **Target Information** Page:
  1. Export to JSON.
  2. Chose Local File and enter a valid path.
  3. (optional) Check Prettify JSON

targetinformationpage

Tested: 2017-06-16 against an Azure CosmosDB instance

6
Jurion On

Use the Azure DocumentDB Data Migration Tool to export and import DocumentDB collections.

To export, select "JSON file" as target and your documentDB as source

UPDATE : new (better) version is avalible here : https://github.com/Azure/azure-documentdb-datamigrationtool

0
Arthur On

Use MongoExport if you've enabled the Mongo interface in Cosmos: https://www.mongodb.com/docs/database-tools/mongoexport/.