![](/img/trans.png)
[英]How to check if a container exists in cosmos DB using the node sdk?
[英]how to change throughput of azure cosmos db container using nodejs sdk?
如何使用nodejs(javascript SDK)更新現有容器的吞吐量?
參考: https ://docs.microsoft.com/en-us/azure/cosmos-db/set-throughput#update-throughput-on-a-database-or-a-container
請檢查以下REST API請求:
curl -X PUT \
https://mydbinstance.documents.azure.com/offers/pSMeVMS0g3fc= \
-H 'Accept: */*' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: mydbinstance.documents.azure.com' \
-H 'authorization: type=master&ver=1.0&sig=XE8P49N9Y9yhny09yYJY690N9th9JOIHYnh9N8N89NTHn*TjH=' \
-H 'content-length: 266' \
-H 'x-ms-date: Fri, 03 May 2019 10:05:06 GMT' \
-H 'x-ms-version: 2016-07-11' \
-d '{
"id": "pSMeVMS0g3fc=",
"_rid": "pSMeVMS0g3fc=",
"_self": "offers/pSMeVMS0g3fc=/",
"offerVersion": "V2",
"resource": "dbs/pNZpAA==/colls/pSMeVMS0g3fc=/",
"content": {
"offerThroughput": 4000
},
"offerResourceId": "pSMeVMS0g3fc="
} '
錯誤響應:輸入授權令牌無法為請求提供服務。 請檢查是否按照協議構建了預期的有效負載,並檢查所使用的密鑰。
您可以通過傳遞選項來修改它,如下所示
/The following code will create a collection in the database. This is where the documents will be stored.
client.createCollection(databaseUrl, cosmosDb.collection, { offerThroughput: 400 }, (err, created) => {
if (err) {
console.log(err);
}
else {
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.