azure-cosmosdb

How upload file to blob storage and reference it from cosmosdb document in attachment

♀尐吖头ヾ 提交于 2020-06-13 09:40:05
问题 I'm new to CosmosDb and azure blob storage, as a requirement I need to reference a file uploaded to azure blob storage from a document in CosmosDb and use it in the attachment section to save the metadata. I know the json metadata stucture should be like this: { "id":"image13d65101-90c4-4c2a-a423-fbf221c73233", "contentType":"image/jpg", "media":"www.bing.com", "_rid":"rnYYAMVFUAUBAAAAAAAAAEC+LNM=", "_ts":1408056025, "_self":"dbs\/rnYYAA==\/colls\/rnYYAMVFUAU=\/docs\/rnYYAMVFUAUBAAAAAAAAAA==\

Azure Cosmos DB aggregation and indexes

*爱你&永不变心* 提交于 2020-06-13 05:33:03
问题 I'm trying to use Cosmos DB and I'm having some trouble making a simple count in a collection. My collection schema is below and I have 80.000 documents in this collection. { "_id" : ObjectId("5aca8ea670ed86102488d39d"), "UserID" : "5ac161d742092040783a4ee1", "ReferenceID" : 87396, "ReferenceDate" : ISODate("2018-04-08T21:50:30.167Z"), "ElapsedTime" : 1694, "CreatedDate" : ISODate("2018-04-08T21:50:30.168Z") } If I run this command below to count all documents in collection, I have the result

Azure Cosmos DB aggregation and indexes

大兔子大兔子 提交于 2020-06-13 05:32:00
问题 I'm trying to use Cosmos DB and I'm having some trouble making a simple count in a collection. My collection schema is below and I have 80.000 documents in this collection. { "_id" : ObjectId("5aca8ea670ed86102488d39d"), "UserID" : "5ac161d742092040783a4ee1", "ReferenceID" : 87396, "ReferenceDate" : ISODate("2018-04-08T21:50:30.167Z"), "ElapsedTime" : 1694, "CreatedDate" : ISODate("2018-04-08T21:50:30.168Z") } If I run this command below to count all documents in collection, I have the result

how to insert json into cosmos db collection using c#

大城市里の小女人 提交于 2020-05-30 07:42:06
问题 I have a Json file which I wanted to store in a cosmos DB Collection. How can I add a complete Json file using C#? Is there any client library for the same? I have already gone through the below URL Microsoft URL but getting below issue with it Response status code does not indicate success: 400 Substatus: 1001 Reason: (Message: {"Errors":["PartitionKey extracted from document doesn't match the one specified in the header"]}ActivityId: 1ce4974b-0897-4823-9c04-be3acf358d9b, Request URI: /apps

how to compare only date part in cosmos db

六月ゝ 毕业季﹏ 提交于 2020-05-27 06:37:05
问题 We are storing (EmployeeId,Name,LogDate) data in cosmosdb. LogDate data is Datetime and we want to get data from cosmos where LogDate between '2018-01-15' and '2018-01-30', Means want to compare date part only. 回答1: Based on the statements in the official document: Alternatively, you can store DateTimes as Unix timestamps, that is, as a number representing the number of elapsed seconds since January 1, 1970. Azure Cosmos DB's internal Timestamp (_ts) property follows this approach. You can

How to handle Transaction in CosmosDB - “All or nothing” concept

为君一笑 提交于 2020-05-23 23:59:28
问题 I am trying to save multiple Document to 'multiple Collection' at once in one Transaction. So if one of the save fail, then all the saved document should RollBack I am using SpringBoot & SpringData and using MongoAPi to connect to CosmosDB in Azure. I have read in their portal that this can be done by writing some Stored procedure. But is there a way we can do it from code like how spring have @Transaction annotation.? Any help is really appreciated. 回答1: The only way you can write

COSMOS DB Deployment failures

☆樱花仙子☆ 提交于 2020-05-16 19:14:43
问题 I have been struggling to create a COSMOS DB since a couple of days...I am getting this below error which doesnt make any sense to me. What does this error mean and what to do? {"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"Conflict","message":"{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \

COSMOS DB Deployment failures

我怕爱的太早我们不能终老 提交于 2020-05-16 19:11:20
问题 I have been struggling to create a COSMOS DB since a couple of days...I am getting this below error which doesnt make any sense to me. What does this error mean and what to do? {"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"Conflict","message":"{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \

How can I use LINQ in CosmosDB SDK v3.0 async query?

筅森魡賤 提交于 2020-05-12 19:52:22
问题 I've been following the official documentation here: https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-get-started#Query But I can't figure out how to correctly use a LINQ expression instead on an SQL string. I experimented with GetItemLinqQueryable, but I don't know if is the right way to use it. Also is not async. var db = Client.GetDatabase(databaseId); var container = db.GetContainer(containerId); var q = container.GetItemLinqQueryable<Person>(); var result = q.Where(p => p.Name ==

How can I use LINQ in CosmosDB SDK v3.0 async query?

烂漫一生 提交于 2020-05-12 19:42:58
问题 I've been following the official documentation here: https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-get-started#Query But I can't figure out how to correctly use a LINQ expression instead on an SQL string. I experimented with GetItemLinqQueryable, but I don't know if is the right way to use it. Also is not async. var db = Client.GetDatabase(databaseId); var container = db.GetContainer(containerId); var q = container.GetItemLinqQueryable<Person>(); var result = q.Where(p => p.Name ==