Questions tagged [azure-cosmosdb-sqlapi]
1222 questions
4
votes
3 answers
Azure Cosmos DB SDK v3 query for multiple documents fails: Gateway Failed to Retrieve Query Plan
Using the Cosmos DB SQL API in the Cosmos SDK v3, I'm attempting to query the projects container, which has an /organization partition key.
var cosmosDb = await Storage.GetCosmosDb();
var queryDefinition = new QueryDefinition($"SELECT * FROM…

Scotty H
- 6,432
- 6
- 41
- 94
4
votes
1 answer
Cosmos Db Throughput
Is there any option to retrieve Cosmos DB (SQL API) throughput programmatically. I'm using the below code to get the list of DB
DocumentClient client = new DocumentClient(ClientURL, ClientKey,);
var databaseList =…

user1941025
- 541
- 6
- 21
4
votes
1 answer
Azure Cosmos DB change feed retry a specific document
We are using Cosmos DB change feed to solve some of our requirements. Wanted to understand if there is any retry mechanism available in change feed. For example, if I get a batch of 10 documents and 3rd one can't be processed for some reason, can I…

Amlan
- 241
- 6
- 13
4
votes
2 answers
How can I get the current time in Cosmos DB
I'm looking for the equivalent of MySQL now(). Any format is fine.

Michael Munsey
- 3,740
- 1
- 25
- 15
3
votes
1 answer
How to establish Cosmos DB database connection with nestjs v^9.0.0
I'm trying to import the Cosmos DB connection module in nestjs v9, but I'm getting dependencies errors.
Nest can't resolve dependencies of the AzureCosmosDbCoreModule (COSMOS_DB_CONNECTION_NAME, ?). Please make sure that the argument ModuleRef at…

jonathan
- 63
- 5
3
votes
2 answers
Cosmos DB SQL nested array query
I am trying to write a query for Cosmos DB which would involve filtering nested arrays. I have a schema similar to
{
"studentname": {
"first": "John",
"last": "Doe",
},
"information":{
"address":[
{
"county" : "Derby",
…

binaryCoder
- 45
- 1
- 5
3
votes
1 answer
How to do inner join with two containers in Cosmos DB
I have two containers in Cosmos DB and I need to do an inner join between them.
Exemple:
VD_VENDAS
VD_ESTOQUE
VD_COMPRAS
I need to do inner join between VD_VENDAS and VD_ESTOQUE. I try it:
SELECT v.obraId
FROM VD_VENDAS v
JOIN VD_ESTOQUE e IN…

Leidiane Beatriz
- 31
- 2
3
votes
1 answer
Cosmos query to get the items inside list
I have a data structure like this:
{
"commonId":"123",
"Answers": [
{
"QuestionType": "1",
"Answer": [
"answer1"
]
},
{
"QuestionType": "1",
"Answer": [
"answer2"
…

user3501613
- 596
- 7
- 28
3
votes
1 answer
Azure Cosmos SQL - working with nested arrays and using LIKE keyword
For some time when I had to find particular element of array by particular value I've been using ARRAY_CONTAINS function. Now I have documents with nested arrays where I have to search not but particular value, but using regex.
As an example of…

Vladimir Glushkov
- 521
- 7
- 16
3
votes
2 answers
Get multiple counts with one Cosmos DB query?
Consider these queries:
SELECT COUNT(1) AS failures
FROM c
WHERE c.time = 1623332779 AND c.status = 'FAILURE'
SELECT COUNT(1) AS successes
FROM c
WHERE c.time = 1623332779 AND c.status = 'SUCCESS'
How can I combine these two distinct…

jskattt797
- 231
- 2
- 10
3
votes
0 answers
CosmosDB: ReadItemAsync takes more RU than using queryable for items with large nested collection
I ran into unexpected behavior when loading items using ReadItemAsync and GetItemLinqQueryable. ReadItemAsync seems to be cheaper and faster as it does "point read" as described here…

Ann
- 176
- 1
- 5
3
votes
1 answer
Cosmos SQL db create item
I have an issue with cosmos SQL db python sdk and I have no idea how to fix it.
I have a data explorer with some data in. And I am using python sdk to query this data and save the output in a json file. So far everything works just fine. But I…

Nayden Van
- 1,133
- 1
- 23
- 70
3
votes
1 answer
Azure CosmosDB stored procedure to update all items' field
Let's say we have a container with following items
{
location:CA,
bool: false
}
{
location:CA,
bool: false
}
{
location:CA,
bool: false
}
How do we write a stored procedure to query all items and update all item's bool field from…

szastronaut
- 55
- 1
- 5
3
votes
2 answers
Transactional batch cosmos - write IF certain value read in partition
Using transactional batch in cosmos, is it possible to query a partition within a collection (Select * from partition where openOrder=1) and then IF the query returns that there are no open orders, add an item to the collection.
Or you could have…

WIT
- 1,043
- 2
- 15
- 32
3
votes
1 answer
Obtain a list of dynamic objects from a CosmosDB database with .NET SDK v.4
I'm trying to query a database where the stored entities have different properties and I want to retrieve some fields from this information with diferently shaped queries (thats the point of using an schemaless database) but I'm having no luck with…

Vi100
- 4,080
- 1
- 27
- 42