Questions tagged [azure-cosmosdb-sqlapi]

1222 questions
40
votes
2 answers

How to write a LIKE query in Azure CosmosDB?

I want to retrieve data from Cosmos DB with the following query: SELECT * FROM c WHERE c.pi like '09%001' (This is a SQL query, which I can use in MySQL) Here, pi is a string value, which can be 09001001 or 09025001. Is there a way to use a LIKE…
arjan kroon
  • 813
  • 2
  • 9
  • 22
23
votes
5 answers

Azure Cosmos DB SQL API UPDATE statement - don't replace whole document

Can I write an UPDATE statement for Azure Cosmos DB? The SQL API supports queries, but what about updates? In particular, I am looking to update documents without having to retrieve the whole document. I have the ID for the document and I know the…
Scotty H
  • 6,432
  • 6
  • 41
  • 94
20
votes
2 answers

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

I've been following the official documentation here: https://learn.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…
Francesco Cristallo
  • 2,856
  • 5
  • 28
  • 57
14
votes
5 answers

How to clear a Cosmos DB database or delete all items using Azure portal

If go to https://portal.azure.com, open our Azure Cosmos DB account (1) --> Data Explorer (2) --> Click on users (3) --> Click on New SQL Query: Azure will open a text box to enter a Query: I've found that Cosmos DB does not allow the usage of…
chelder
  • 3,819
  • 6
  • 56
  • 90
14
votes
2 answers

what is the compatible in memory db for azure cosmos db

I am integrated my spring boot application with azure CosmosDB-SQL API and for integration test cases i want to use in memory database but trying with H2 in memory it's not working
prasanna chouta
  • 149
  • 1
  • 4
13
votes
2 answers

Cosmos DB Patch child object

I'm trying to patch a child object of a Cosmos Db document using the new Partial Document Update feature. However, I can't find a way to do it. If the document looks like below, how would you update child (in the Items array) with ID 2 ProductCode…
Pietv
  • 215
  • 2
  • 8
13
votes
2 answers

How to use HAVING in CosmosDB

I am trying to use the following query to see if I have duplicates in the DB SELECT c.VariantNo, count(1) AS jongel FROM c where c.brand = 'XXXX' AND c.Consumer = 'XXX_V2' GROUP BY c.VariantNo HAVING jongel > 1 But I am getting a syntax error close…
Matt Douhan
  • 2,053
  • 1
  • 21
  • 40
11
votes
0 answers

408 status code from Cosmos DB using SDK v3

I have an API (.NET Core 2.2) which retrieves documents from Cosmos DB using SDK v3.5.0. Currently some requests are throwing an exception due to timeouts on requests to Cosmos DB - the response is 408 status code. It's worth mentioning that the 90%…
Juanjo
  • 111
  • 1
  • 4
10
votes
2 answers

Indexing the partition key in Azure Cosmos DB

Suppose I've the following data in my container: { "id": "1DBF704E-1623-4844-DC86-EFA729A5C048", "firstName": "Wylie", "lastName": "Ramsey", "country": "AZ", "city": "Tucson" } Where I use the field "id" as the item id, and the…
10
votes
2 answers

CosmosDB SQL query syntax for if statement

I'm trying to find the correct syntax for doing an If/Case type of statement in an Azure ComsmosDB SQL query. Here is the document that I have { "CurrentStage": "Stage2", "Stage1": { "Title": "Stage 1" }, "Stage2": { "Title": "Stage…
Paul Cavacas
  • 4,194
  • 5
  • 31
  • 60
9
votes
3 answers

Can Cosmos SDK3 Container be a singleton?

I would like to reduce load on Azure Cosmos DB SQL-API, which is called from a .NET Core Web API with dependency injection. In App Insights, I have noticed that every call to the Web API results in GetDatabase and GetCollection calls to Cosmos which…
user1857450
  • 551
  • 8
  • 20
9
votes
2 answers

How to find Duplicate documents in Cosmos DB

I have seen like a huge amount of data write to cosmos DB from stream analytics job on a particular day. It was not supposed to write huge amount of documents in a day. I have to check if there is duplication of documents on that particular day. Is…
8
votes
1 answer

What are PartitionKeyRangeId(s) in Cosmos DB?

We have recently started testing Cosmos DB as a persistent storage for our Orleans Cluster. Our scenario for Cosmos DB is as a Key-Value Store with low-latency and a high amount of Replace, Point Reads and Creates. Due to this we have Document IDs…
8
votes
3 answers

Response status code does not indicate success when inserting documents

Have have following partion id on my container: /vesselId I am trying to add a collection of this object: public class CoachVessel { [JsonProperty("id")] public string vesselId { get; set; } [JsonProperty("imo")] public long Imo {…
Thomas Segato
  • 4,567
  • 11
  • 55
  • 104
8
votes
1 answer

How do I change API in cosmosDB?

I have a cosmosDB with mongo API, however there are many features not supported in this API so I want to switch to SQL API?
1
2 3
81 82