Questions tagged [azure-cosmosdb-sqlapi]

1222 questions
4
votes
1 answer

Bring results from CosmosDB and place it in a C# class containing a property pointing to another class

On my CosmosDB, I've this json document: --- Category example on Container Categories { "id": "expert_talks", "name": "Expert Talks", } --- Timeline example on Container Timeline "id": "30122021170000", "type": "PDF", …
Marco Jr
  • 6,496
  • 11
  • 47
  • 86
4
votes
2 answers

Indexing for GROUP BY in CosmosDB

As the title suggests I'm wondering how to create an effective index for GROUP BY queries in CosmosDB. Say the documents look something like: { "pk": "12345", "speed": 500 }, { "pk": "6789", "speed": 100 } Doing a query to find out…
4
votes
1 answer

Cosmos DB - Is it safe to exclude system attributes like _ts, _rid and _self from indexing?

When a container is created with default indexing policy, I noticed that _etag is automatically added to the excluded paths which is quite understandable because of it being opaque and all and you should not be building any application logic on its…
Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
4
votes
5 answers

Getting "One of the specified inputs is invalid" in Azure CosmosDb PatchItemAsync

Below is the code that I have: List patchOperations = new List(); patchOperations.Add(PatchOperation.Replace("/endpointId", 100)); string id = "id1"; PartitionKey partitionKey = new…
chiaDev
  • 389
  • 3
  • 17
4
votes
3 answers

Cosmos DB .NET SDK V3 Query With Paging example needed

I'm struggling to find a code example from MS for the v3 SDK for queries with paging, they provide examples for V2 but that SDK is a completely different code base using the "CreateDocumentQuery" method. I've tried searching through GitHub here:…
OJB1
  • 2,245
  • 5
  • 31
  • 63
4
votes
3 answers

Creating several roles definition and assignment with Bicep template for Azure Cosmos DB

I try to create two role definitions and two role assignments to one Azure CosmosDB SQL API account using Bicep template. I decompiled below arm template with az bicep…
gorrch
  • 521
  • 3
  • 16
4
votes
1 answer

Handling reads of Cosmos DB container with multiple types?

I'd like to store several different object types in a single Cosmos DB container, as they are all logically grouped and make sense to read together by timestamp to avoid extra HTTP calls. However, the Cosmos DB client API doesn't seem to provide an…
Michael Tontchev
  • 909
  • 8
  • 23
4
votes
2 answers

Autogenerate id in Cosmos DB from Spring Boot

How can I generate an autoincremented Id in a Cosmos DB if I do a POST request from Spring Boot.
Techie
  • 81
  • 1
  • 10
4
votes
1 answer

Can I use a client constructed session token for cosmosdb?

I've done a bit of research on using session token in cosmosdb's dotnet v3 sdk, and so far I found these two links that give me some hints on how to use it: utilize-session-tokens and how-to-convert-session-token. In our scenario, we would like to…
4
votes
2 answers

Selecting the latest document for each "Group"

I am using Azure Cosmos DB SQL API to try to achieve the following; We have device data stored within a collection and would love to retrieve the latest event data per device serial effectively without having to do N queries for each device…
David
  • 693
  • 7
  • 20
4
votes
3 answers

Not able to change cosmosdb container throughput from Manual to Autoscale using CosmosDB V3 SDK

I am trying to replace the throughput of a manual container to autoscale using this code container.ReplaceThroughputAsync(ThroughputProperties.CreateAutoscaleThroughput(4000)); This throws an…
Hamdan Sultan
  • 226
  • 4
  • 16
4
votes
2 answers

Azure Cosmos C# SDK v3 Returning Invalid Continuation Token

I'm working through migrating an application from Cosmos C# SDK v2 to v3. I hit a roadblock with pagination and can't seem to figure it out. I have a request that will search a particular container and paginate through requests. My code is setup to…
Nate
  • 345
  • 3
  • 12
4
votes
2 answers

How to get all items of container in cosmos db with dotnet core

Hi I would like to get all items of a container in a database in cosmos DB. I can see that there are already a lot of methods available but I don't see any getAllItems or a lookalike. Is there an easy way to do it like using LINQ or…
Bendomin
  • 45
  • 1
  • 1
  • 4
4
votes
0 answers

Why is getting COUNT of results so expensive?

If I run a query, such as this one below: SELECT DISTINCT c.vin, c.year-model-trim, c.make FROM c WHERE c.make= @make // make is partition key AND c.manufactured > '2020-01-01' I'll get 25 documents back, with query stats resembling…
todon2
  • 61
  • 8
4
votes
1 answer

Cosmos DB queries - using ORDER BY when a property does not exist in all documents

We are experiencing an issue in when writing queries for Cosmos Document DB and we want to create a new document property and use it in an ORDER BY clause If, for example, we had a set of documents like: { "Name": "Geoff", "Company":…
ElGringo
  • 369
  • 3
  • 10