简体   繁体   中英

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.

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 });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM