The MongoDB API lets existing MongoDB applications use Azure Cosmos DB without application modifications. It supports MongoDB’s BSON document structure, queries, and drivers, making migration less dramatic than a database rewrite. section 11.2.1
Choose the API that matches the application’s data model and existing technology. MongoDB fits Alpaca-Ma-Bags because its application already uses MongoDB; other Cosmos DB APIs target document, table, PostgreSQL, Cassandra, or graph workloads. section 11.2.1
A MongoDB-compatible Cosmos DB setup follows a straightforward hierarchy:
- Create a Cosmos DB account with the MongoDB kind and EnableMongo capability. section 11.1
- Create a MongoDB database inside the account. section 11.1
- Create a container for documents, choosing a shard key and throughput setting. section 11.1
Alpaca-Ma-Bags migration
Alpaca-Ma-Bags can keep its MongoDB queries and drivers while moving its product data to Cosmos DB. Its account uses Session consistency, and its container can use a shard key with provisioned or autoscaled throughput. section 11.2.1 section 11.1
