user3609351
user3609351

Reputation: 169

How to set the throughput to 10000 RU for Azure Cosmos DB Mongo API in code

How to set the throughput to 10000 RU for Azure Cosmos DB Mongo API in code? Im using Mongo.Driver for .NET. Want to use something like db.RunCommand to set the throughput to 10.000 RU.

Upvotes: 0

Views: 2872

Answers (1)

Jay Gong
Jay Gong

Reputation: 23782

In my opinion, the MongoDB API implements MongoDB functionality, while RU and throughput are concepts in Azure Cosmos DB. Please don't get confused.

So, we have no way to set RU with the Mongo shell command line, which is not supported.

However, you could set RU in the Document DB SDK refer to the official code as follows:

DocumentCollection myCollection = new DocumentCollection();
myCollection.Id = "coll";
myCollection.PartitionKey.Paths.Add("/deviceId");

await client.CreateDocumentCollectionAsync(
    UriFactory.CreateDatabaseUri("db"),
    myCollection,
    new RequestOptions { OfferThroughput = 3000 });

Upvotes: 3

Related Questions