azure-cosmosdb

WHERE clause on an array in Azure DocumentDb

岁酱吖の 提交于 2019-12-18 01:33:21
问题 In an Azure Documentdb document like this { "id": "WakefieldFamily", "parents": [ { "familyName": "Wakefield", "givenName": "Robin" }, { "familyName": "Miller", "givenName": "Ben" } ], "children": [ { "familyName": "Merriam", "givenName": "Jesse", "gender": "female", "grade": 1, "pets": [ { "givenName": "Goofy" }, { "givenName": "Shadow" } ] }, { "familyName": "Miller", "givenName": "Lisa", "gender": "female", "grade": 8 } ], "address": { "state": "NY", "county": "Manhattan", "city": "NY" },

cosmos db sql query with non alphanumeric field name

强颜欢笑 提交于 2019-12-17 21:10:05
问题 My data structure in cosmosdb is next { "_id": { "$oid": "554f7dc4e4b03c257a33f75c" }, ................. } and I need to sort collection by $oid field. How should I form my sql query? Normal query SELECT TOP 10 * FROM collection c ORDER BY c._id.filedname not works if fieldname starts with $ like $oid . I am using query explorer from azure portal. 回答1: To use a special character, like $ , you need to use bracket notation: SELECT c._id FROM c order by c._id["$oid"] You can do this with each

Azure Cosmos DB asking for partition key for stored procedure

痴心易碎 提交于 2019-12-17 20:49:00
问题 I am using GUID Id as my partition key and I am facing problem when I am trying to run a stored procedure. To run a store procedure I need to provide partition key ans I am not sure what value should I provide in this case? Please assist. 回答1: If the collection the stored procedure is registered against is a single-partition collection, then the transaction is scoped to all the documents within the collection. If the collection is partitioned, then stored procedures are executed in the

How to do a Case Insensitive search on Azure DocumentDb?

独自空忆成欢 提交于 2019-12-17 19:37:48
问题 is it possible to perform a case insensitive search on DocumnetDb? Let's say I have a record with 'name' key and value as "Timbaktu" This will work: select * from json j where j.name = "Timbaktu" This wont: select * from json j where j.name = "timbaktu" So how do yo do a case insensitive search? Thanks in advance. Regards. 回答1: There are two ways to do this. 1. use the built-in LOWER/UPPER function, for example, select * from json j where LOWER(j.name) = 'timbaktu' This will require a scan

What uniquely defines the RequestContinuation token in CosmosDb

筅森魡賤 提交于 2019-12-14 03:57:56
问题 I am going through paging the results returning from CosmosDb and for that I need to understand what uniquely defines the FeedOptions.RequestContinuation string. I can make the paging work, so that is not the issue, but its uniqueness is needed for our purposes. What astonished me, for instance, is that the RequestContinuation token is not the same if I perform the following: -Create data in the emulator for two pocos -Query items with MaxItemCount -Get the first RequestContinuation token and

How to store json content to CosmosDB with CreateDocumentAsync

亡梦爱人 提交于 2019-12-14 02:41:32
问题 TARGET: Create Console Application, which 1) Read json from Azure Data Lake Store 2) Store data to Cosmos DB as json. (In next step I will parse json contents in code before storing) PROBLEM: New Document is created in CosmosDB, but it contains some kind of meta data instead of actual json file content. String json do include content I need, but it is not passed correctly to CreateDocumentAsync. I would appreciate help with fixing issue and also appreciate tips to make code easy to handle

Passing parameter to CosmosDB stored procedure

岁酱吖の 提交于 2019-12-13 22:25:19
问题 I have a Cosmos DB stored procedure in which I am passing list of comma saperated Ids. I need to pass those IDs to in query. when I'm passing one value to the parameter then its working fine but not with more that one value. It would be great if any one could help here. below is the code of the stored procedure: function getData(ids) { var context = getContext(); var coll = context.getCollection(); var link = coll.getSelfLink(); var response = context.getResponse(); var query = {query:

Azure Function CosmosDB Trigger returned encoded data?

南楼画角 提交于 2019-12-13 20:19:55
问题 I wrote a short azure function to simply take data in from CosmosDB change feed Trigger. However, looks like it returns some form of encoded data. For example { "_id" : ObjectId("5ad8db107dfa95101430ab94"), "id" : "task123", "type" : "genera123l", "information" : "some task" } If above document is created in my cosmos db, public static void Run(IReadOnlyList<Document> documents, TraceWriter log) { if (documents != null && documents.Count > 0) { log.Info("Documents modified " + documents.Count

Does Cosmos DB support Gremlin.net c# GLV?

房东的猫 提交于 2019-12-13 20:12:43
问题 I cannot find this information, and also I cannot find examples on how to use Gremlin.net c# GLV with a remote Cosmos DB graph. Someone knows anything about this? Thanks! 回答1: Currently CosmosDB does not support GLV's as they do not yet have Bytecode support. They have told me that they are working on it and expect it to be available soon. 来源: https://stackoverflow.com/questions/49512146/does-cosmos-db-support-gremlin-net-c-sharp-glv

Duplicates returned in query on child object

南楼画角 提交于 2019-12-13 18:27:02
问题 I have a data structure in my document like this (note this is simplified for brevity): { "id": "c1c1c1c1-c1c1-c1c1-c1c1-c1c1c1c1c1c1", "name": "Bruce Banner", "accountId": "a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1", "contributors": [{ "accountId": "a2a2a2a2-a2a2-a2a2-a2a2-a2a2a2a2a2a2", "type": "Foo" },{ "accountId": "a3a3a3a3-a3a3-a3a3-a3a3-a3a3a3a3a3a3", "type": "Bar" }] }, { "id": "c2c2c2c2-c2c2-c2c2-c2c2-c2c2c2c2c2c2", "name": "Tony Stark", "accountId": "a2a2a2a2-a2a2-a2a2-a2a2-a2a2a2a2a2a2"