Create mongo collection in cosmos with shared throughput with mongodb .net driver

m. knief 1 Reputation point
2020-07-24T16:46:15.927+00:00

I have an application which uses a cosmosdb with a mongoAPI. The application connects to the db with the MongoDb .net driver to create collections programatically, however it creates the collections without shared throughput. Is there a way to create a collection using shared throughput with the MongoDb .net driver?

13711-throughput.png

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,449 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mark Brown - MSFT 2,761 Reputation points Microsoft Employee
    2020-07-25T22:52:10.417+00:00

    The drivers written by MongoDB don't understand Shared Throughput.

    If you want a .NET library that can create a Mongo DB database with shared throughput and collections underneath, an option you can use is the Azure Management Libraries for .NET. There is a repo with a bunch of samples that show how to create and manage Cosmos DB resources directly against its control plane, cosmos-management-net

    Here is a specific sample for creating MongoDB resources in Cosmos DB MongoDB.cs.

    I would use the generated libraries. The fluent ones are not as well supported.

    0 comments No comments