Mobile Monitoring Solutions

Search
Close this search box.

Intra-Account Collection Copy in Azure Cosmos DB for MongoDB in Public Preview – InfoQ

MMS Founder
MMS RSS

Posted on nosqlgooglealerts. Visit nosqlgooglealerts

Microsoft recently introduced the public preview of Intra-Account Collection Copy for Azure Cosmos DB for MongoDB, allowing users to copy collections within the same account – offering enhanced data management and migration capabilities.

Azure Cosmos DB is a fully managed NoSQL database with various APIs targeted at NoSQL workloads such as MongoDB and Apache Cassandra, including native NoSQL and compatible APIs. In addition, the service supports relational workloads for PostgreSQL.

Last year the company first introduced the preview for Intra-account container copy jobs to allow users to create offline copies of containers for Azure Cosmos DB for both Core (SQL) API and Cassandra API using Azure CLI. Azure Cosmos DB now also has an Intra-Account Collection Copy feature for MongoDB that, according to the company, “enables users to copy collections within the same Azure Cosmos DB account in an offline manner.”

An account in Cosmos DB contains all the Azure Cosmos DB resources: databases, containers, and items. When creating an account, users can select the MongoDB API. Subsequently, they can add a database and collection (container). Within the account, users can create multiple collections.

The feature for copy collections with a MongoDB account can be helpful for data migrations, like when data has evolved and queries are no longer efficient with the existing shard key. Users can choose another shard key on a new collection and migrate the data using a collection copy. Another use case is updating the unique key index of a container by defining a new unique key index policy and migrating data to the new collection using a collection copy.

Users can register for the preview feature and install the Azure Cosmos DB preview extension through the CLI to migrate a collection or database. Next, choose the source and destination collection where they want to copy the data and start the collection copy operation from the Azure CLI. Lastly, users can monitor the progress.

A job to copy a container within an Azure Cosmos DB API for a MongoDB account:

az cosmosdb dts copy `
    --resource-group $resourceGroup `
    --account-name $accountName `
    --job-name $jobName `
    --source-mongo database=$sourceDatabase collection=$sourceCollection `
    --dest-mongo database=$destinationDatabase collection=$destinationCollection

Several other cloud database services support MongoDB. One is MongoDB Atlas, MongoDB’s own fully managed cloud database service. This database service also supports data migration from one database to another, comparable to the Cosmos DB for MongoDB’s latest feature, Inter-Account Collection copy. With MongoDB Atlas users can bring data from existing MongoDB deployments, JSON, or CSV files into deployments in Atlas using either live migration, where Atlas assists them, or tools for a self-guided migration of data from their existing deployments into Atlas.

Lastly, the documentation provides a list of the Azure regions supporting the feature.

About the Author

Subscribe for MMS Newsletter

By signing up, you will receive updates about our latest information.

  • This field is for validation purposes and should be left unchanged.