azure-cosmosdb

Session Consistency and the .NET Client SDK

走远了吗. 提交于 2020-02-28 05:49:06
问题 I am trying to understand what Sessions Consistency actually means when working with Azure DocumentDb via the .NET client SDK i.e. What defines (and bounds) a session. Is a new session created each time we create a new instance of DocumentClient and if so does the behavior change if we are using the IReliableReadWriteDocumentClient wrapper? 回答1: Yes, a new session is created each time you create a new instance of the DocumentClient class. Each DocumentClient instance maintains a map of

Is _ts on documentdb document indexed?

若如初见. 提交于 2020-02-24 18:39:53
问题 Is it better to include my own time-stamp (with milliseconds) for higher performance queries using BETWEEN look-ups based on time-stamp? I understand from previous posts that it is represented as number of seconds since 1970. Since it is a core element I might guess it is not indexed. 回答1: _ts is range-indexed and max precision (-1) by default in DocumentDB, unless overridden explicitly by the user. Therefore you can execute range queries against it. That said, if you need a more granular

DocumentDB call hangs

混江龙づ霸主 提交于 2020-02-24 04:35:20
问题 I'm calling my DocumentDB database to query for a person. If the person is not in the database, I'm then trying to insert the person into my collection. When I check the collection, I see that the new person is being created but my code just seems to hang where I make the second call to insert the person into the collection. Any idea why my code is hanging? I'm not including all the code to save space e.g. GetDatabaseAsync(), GetCollectionAsync(), etc. are all working. using (client = new

Getting 'query in command must target a single shard'

…衆ロ難τιáo~ 提交于 2020-02-21 12:44:45
问题 I have a CosmosDB setup using the Mongo API. I have a collection with a hashed shard on one of the field of the document. When I run commands like db.collection.remove or db.collection.deleteMany I get the following error. Command deleteMany failed: query in command must target a single shard key.: {"message":"Command deleteMany failed: query in command must target a single shard key."} I'm not sure how can I mention a shard key as part of the query considering I want the query to run across

Cosmos DB Mongo API How to manage “Request Rate is Large” condition

允我心安 提交于 2020-02-19 19:32:26
问题 I Have the following code.. async function bulkInsert(db, collectionName, documents) { try { const cosmosResults = await db.collection(collectionName).insertMany(documents); console.log(cosmosResults); return cosmosResults } catch (e) { console.log(e) } } If I run it with a large array of documents I get ( not unexpectedly) { MongoError: Message: {"Errors":["Request rate is large"]} ActivityId: b3c83c38-0000-0000-0000-000000000000, Request URI: /apps/DocDbApp/services/DocDbServer24/partitions

Cosmos DB Mongo API How to manage “Request Rate is Large” condition

徘徊边缘 提交于 2020-02-19 19:30:32
问题 I Have the following code.. async function bulkInsert(db, collectionName, documents) { try { const cosmosResults = await db.collection(collectionName).insertMany(documents); console.log(cosmosResults); return cosmosResults } catch (e) { console.log(e) } } If I run it with a large array of documents I get ( not unexpectedly) { MongoError: Message: {"Errors":["Request rate is large"]} ActivityId: b3c83c38-0000-0000-0000-000000000000, Request URI: /apps/DocDbApp/services/DocDbServer24/partitions

Using reserved word field name in DocumentDB

别说谁变了你拦得住时间么 提交于 2020-02-11 13:36:45
问题 I inherited a database loaded into DocumentDB, where field name happens to be "Value". Example of my structure is: { ... "Alternates": [ "Type": "ID", "Value" : "NOCALL" ] } when I query (using documentDB's SQL), trying to get back all documents where Alternates.Value = "NOCALL", I get syntax error near "Value" error . If I query for Type = "ID", it is all fine. Seems that the word Value, having a special meaning on DocumentDB is causing an issue. Putting punctuation (e.g. quotes/double

update cosmosDB azure sql

有些话、适合烂在心里 提交于 2020-02-06 07:28:22
问题 I'm trying to update a value of document created on cosmosDB azure using sql api. The problem is that the requests update/ delete/ Insert don't work. client.queryDocuments( collectionUrl, UPDATE tableC SET prev = 12 WHERE condition ).toArray((err, results) => { if (err) res.json({ 'A': 12 }); else { res.json({ 'A': 15}); } }) 回答1: CosmosDB SQL is not ANSI SQL implementation. It supports just querying in a somewhat similar manner, but it's not the same thing. From Introduction to Azure Cosmos

How to speed up a Cosmos DB aggregate query?

偶尔善良 提交于 2020-02-02 02:30:08
问题 Our cosmos db aggregate query seems slow and costs a lot of RUs. Here are the details (plus see screenshot below): 2.4s and 3222RUs to count a result set of 414k records. Also this for just one count. Normally we would want to do a sum on many fields at once (possible only within a single partition), but performance for that is much worse. There are 2 million records in this collection. We are using Cosmos DB w/SQL API. This particular collection is partitioned by country_code and there are

Purpose of a Partition Key for a Cosmos DB Fixed (10GB) Collection

流过昼夜 提交于 2020-01-30 05:54:26
问题 In the Cosmos DB docs, I see that allocating a Fixed (10GB) Collection means that there will only ever be a single partition allocated to hold documents within the Collection. My question: if I choose a Fixed Collection, why am I still prompted to choose a partition key if I will only ever have a single partition? My guess is that the single partition refers to a single physical partition, but it is still possible to store N logical partitions (each identified by a partition key) within the