azure-cosmosdb

Inserting to a number of containers in azure cosmos db as one atomic operation

五迷三道 提交于 2020-03-12 05:35:52
问题 I'm a little new to Azure Cosmos DB. I wanted to know if it has an option to make a number of operations on multiple containers as one atomic operation. E.g., all succeed or or fail from a .NET backend. 回答1: Operations are atomic to a single operation in a single container. If you use a Stored Procedure, you may perform an atomic set of multiple operations within a single partition within a single container. You cannot perform any atomic operations across multiple containers, or across

How to Query Cosmos DB graph by use of SQL CONTAINS

倾然丶 夕夏残阳落幕 提交于 2020-03-03 05:37:05
问题 I have a Cosmo DB graph where I would like to access the 'name' field in an expression using the string matching CONTAINS in Cosmos DB. CONTAINS works at 1 level as in matching CONATINS SELECT s.label, s.name FROM s WHERE CONTAINS(LOWER(s.name._value), "cara") AND s.label = "site" I also tried with a UDF function SELECT s.label, s.name FROM s WHERE(s.label = 'site' AND udf.strContains(s.name._value, '/cara/i')) I don't get any hits or syntax errors from Cosmos DB even that should be at least

Invalid index exception when using BulkExecutor in CosmosDb

风流意气都作罢 提交于 2020-03-01 06:38:11
问题 I have an error when I'm trying to use BulkExecutor to update one of the properties in CosmosDb. The error message is "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Important point- I don't have partition key defined on my collection. Here is my code: SetUpdateOperation<string> player1NameUpdateOperation = new SetUpdateOperation<string>("Player1Name", name); var updateOperations = new List<UpdateOperation>(); updateOperations.Add

Invalid index exception when using BulkExecutor in CosmosDb

北城余情 提交于 2020-03-01 06:37:06
问题 I have an error when I'm trying to use BulkExecutor to update one of the properties in CosmosDb. The error message is "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Important point- I don't have partition key defined on my collection. Here is my code: SetUpdateOperation<string> player1NameUpdateOperation = new SetUpdateOperation<string>("Player1Name", name); var updateOperations = new List<UpdateOperation>(); updateOperations.Add

DocumentDB - Does a newer session token guarantee reading back older writes?

烂漫一生 提交于 2020-03-01 05:32:09
问题 Let's assume I have two documents in the same collection/partition, both at "version 1": A1 , B1 . I update A1 -> A2 , the write operation returns a session token SA . Using SA to read document A will guarantee I get version A2 . Now I update B1 -> B2 , and get a new session token SB . Using SB to read document B will guarantee I get version B2 . My question is: does using token SB guarantee I can see older writes as well? I.e. will reading reading A with token SB always get me A2 ? 回答1: Yes.

DocumentDB - Does a newer session token guarantee reading back older writes?

青春壹個敷衍的年華 提交于 2020-03-01 05:28:10
问题 Let's assume I have two documents in the same collection/partition, both at "version 1": A1 , B1 . I update A1 -> A2 , the write operation returns a session token SA . Using SA to read document A will guarantee I get version A2 . Now I update B1 -> B2 , and get a new session token SB . Using SB to read document B will guarantee I get version B2 . My question is: does using token SB guarantee I can see older writes as well? I.e. will reading reading A with token SB always get me A2 ? 回答1: Yes.

how to count distinct value in cosmos DB

女生的网名这么多〃 提交于 2020-02-28 11:00:23
问题 I created some documents in Cosmos DB like this: [ { "class": "class01", "student": { "lastReport": [ { "Name": "st01", "score": "C" }, { "Name": "st02", "score": "B" } ], "lastTime": "2018-05-10" } }, { "class": "class02", "student": { "lastReport": [ { "Name": "st03", "score": "C" }, { "Name": "st01", "score": "A" } ], "lastTime": "2018-05-10" } }, { "class": "class01", "student": { "lastReport": [ { "Name": "st01", "score": "C" }, { "Name": "st02", "score": "A" }, { "Name": "st03", "score"

how to count distinct value in cosmos DB

Deadly 提交于 2020-02-28 11:00:18
问题 I created some documents in Cosmos DB like this: [ { "class": "class01", "student": { "lastReport": [ { "Name": "st01", "score": "C" }, { "Name": "st02", "score": "B" } ], "lastTime": "2018-05-10" } }, { "class": "class02", "student": { "lastReport": [ { "Name": "st03", "score": "C" }, { "Name": "st01", "score": "A" } ], "lastTime": "2018-05-10" } }, { "class": "class01", "student": { "lastReport": [ { "Name": "st01", "score": "C" }, { "Name": "st02", "score": "A" }, { "Name": "st03", "score"

how to count distinct value in cosmos DB

被刻印的时光 ゝ 提交于 2020-02-28 10:58:02
问题 I created some documents in Cosmos DB like this: [ { "class": "class01", "student": { "lastReport": [ { "Name": "st01", "score": "C" }, { "Name": "st02", "score": "B" } ], "lastTime": "2018-05-10" } }, { "class": "class02", "student": { "lastReport": [ { "Name": "st03", "score": "C" }, { "Name": "st01", "score": "A" } ], "lastTime": "2018-05-10" } }, { "class": "class01", "student": { "lastReport": [ { "Name": "st01", "score": "C" }, { "Name": "st02", "score": "A" }, { "Name": "st03", "score"

Session Consistency and the .NET Client SDK

蓝咒 提交于 2020-02-28 05:49:57
问题 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