azure-cosmosdb

sqlQuery of DocumentDB input bindings with modulation symbol makes function's failure

放肆的年华 提交于 2019-12-24 04:13:04
问题 I using the DocumentDB input bindings on Azure Functions. Today, I specified a following query as a sqlQuery. SELECT c.id, c.created_at FROM c WHERE {epoch} - c.created_at_epoch >= 86400*31 AND (CEILING({epoch}/86400) - CEILING(c.created_at_epoch / 86400)) % 31 = 0 Afterwards, I saw a following error when function is triggered. 2017-07-04T10:31:44.873 Function started (Id=95a2ab7a-8eb8-4568-b314-2c3b04a0eadf) 2017-07-04T10:31:49.544 Function completed (Failure, Id=95a2ab7a-8eb8-4568-b314

How to structure relationships in Azure Cosmos DB?

感情迁移 提交于 2019-12-24 03:34:29
问题 I have two sets of data in the same collection in cosmos, one are 'posts' and the other are 'users', they are linked by the posts users create. Currently my structure is as follows; // user document { id: 123, postIds: ['id1','id2'] } // post document { id: 'id1', ownerId: 123 } { id: 'id2', ownerId: 123 } My main issue with this setup is the fungible nature of it, code has to enforce the link and if there's a bug data will very easily be lost with no clear way to recover it. I'm also

Query list of partitions (and/or partition key values) in DocumentDB

旧城冷巷雨未停 提交于 2019-12-24 02:56:16
问题 I am using a partitioned collection for as persistence solution. I am searching for a way to list number of partitions I have and get partition key value for each of them in a collection. But I could not find anything from .NET SDK to achieve this. Could you please help? 回答1: But I could not find anything from .NET SDK to achieve this. Could you please help? I have checked with Microsoft Azure DocumentDB Client and you could leverage DocumentClient.ReadPartitionKeyRangeFeedAsync for getting

DocumentDb transactions as a part of an external transaction scope

ぃ、小莉子 提交于 2019-12-24 02:56:13
问题 Is there a way to make DocumentDb transactions part of an external transaction from C#? This is a follow-up question from here and failure in transaction 3 below should rollback any documentDb updates. using (var scope = new TransactionScope) { //first transaction //write to document db //third transaction } 回答1: I solved this by implementing IEnlistmentNotification on DocumentDbRepository interacting with DocumentDb n the following way - Implement the interface Make the current instance part

cosmos not returning any records when using table api

谁说我不能喝 提交于 2019-12-24 01:57:10
问题 How do you query the database to return records using the table api? My documents look like this: { "id": "069c2612-355a-4659-b680-048b7ef19f5c", "_rid": "3RtVAMJ2mQkBAAAAAAAAAA==", "_self": "dbs/3RtVAA==/colls/3RtVAMJ2mQk=/docs/3RtVAMJ2mQkBAAAAAAAAAA==/", "_etag": "\"00000000-0000-0000-8cc3-3e8f580501d4\"", "FieldType": "InsuranceCode", "TranslateFrom": "XTH", "TranslateTo": "removed", "SourcePaerty": "TMH", "DestinationParty": "GE", "Key": "/TMH/GE/InsuranceCode", "_attachments":

Cosmo ChangeFeed -Errors,exceptions and Service fail scenario's

百般思念 提交于 2019-12-24 01:56:18
问题 All, I am using Change Feed Processor Library.Want to know the best way to handle service failure along with the exceptions/errors scenario's in ProcessChangesAsync method. Below are the events am referring to. 1) Service failure - Service having the processor library crashed in the middle of some operation. How to start the process from the same document(doc on failure instance)? is there any inbuilt mechanism where change feed will start with the last failed documents? E.g. Let assume,in

The SQL query text exceeded the maximum limit of 30720 characters in Azure CosmosDB

只谈情不闲聊 提交于 2019-12-24 01:20:06
问题 I have a query where I use an array with an "IN" style setup. var builder = Builders<Transaction>.Filter; var filter = builder.Eq("App", app) & builder.In("TransactionId", incomingIds); List<string> existingTransactions = collection .Find(filter) .Project(x => x.TransactionId) .ToList(); A while back this started to throw the error below and I had reduce my batch-size significantly to avoid the error. Command delete failed: Errors encountered exception while executing function. Error while

Azure CosmosDB using Mongo Drivers: Get Count With out getting all documents based on element in sub sub document in C#.Net

拟墨画扇 提交于 2019-12-24 01:18:19
问题 Below is my JSON structure which I'm storing in Azure MongoDB(Pasted the sample structure), I want to query using userID element which is present in Plyrs (Sub Sub document) to get list of all tournaments user has played. I have tried with Aggregate() but not succeeded. Please correct me if I'm missing some thing, below is the code for it. Tried to get using builders but not succeeded, using builders I'm able to retrieve up to one level (sub collection , with json(pasted below) reference upto

Azure Data Factory : querying _ts (epoch) field in CosmosDB source

孤街浪徒 提交于 2019-12-24 01:07:29
问题 I am trying to copy data from Azure CosmosDB into Azure SQL Database. In the Azure CosmosDB source, the query is as follows : select * from c where c.DefinitionTime >= '@{formatDateTime(pipeline().parameters.windowStart, 'yyyy-MM-ddTHH:mm:ssZ' )}' AND c.DefinitionTime < '@{formatDateTime(pipeline().parameters.windowEnd, 'yyyy-MM-ddTHH:mm:ssZ' )}' In CosmosDB, "DefinitionTime" is stored as a string. To the run the above query, I have to update "DefinitionTime" with range-indexing which is one

Timeout error when connecting to CosmosDB with MongoDB API

怎甘沉沦 提交于 2019-12-24 00:54:19
问题 I'm currently working through the following tutorial to learn to work with Azure's cosmosdb via the mongodb API: https://docs.microsoft.com/en-us/azure/cosmos-db/tutorial-develop-mongodb-react The finished repo for this tutorial is here: https://github.com/Azure-Samples/react-cosmosdb but so far I'm just on part 5 where you actually try to connect to the cosmos database. I ran into an issue with the mongoose version and substituted the repo code with this found here: Error connecting to Azure