1,325 questions
0
votes
1
answer
56
views
Azure Cosmos DB returns multiple rows for the same SUM or GROUP BY even when using a single partition key
I'm running aggregate queries (SUM, GROUP BY) on an Azure Cosmos DB container (detailed-invoices).
Even though I filter by a single enterpriseId — which is the partition key — Cosmos DB returns ...
0
votes
0
answers
90
views
GROUP BY in sub query undone in outer query
As HAVING is not supported in cosmos db, I am trying to get a count of duplicate records within a document via below query.
select d.firstName, d.lastName, d.dateOfBirth, d.Duplicates
from (
...
1
vote
1
answer
79
views
NullRef exception when initializing CosmosClient in Gateway mode
When I try to initialize the cosmos client (latest sdk version 3.50) in Gateway mode, it throws a null ref exception.
From the stack trace it seems it is unable to find the global endpoint, but an ...
0
votes
1
answer
89
views
How to check for the existince of at least one document in a container that satisfies a condition?
I would like to determine if at least one document exist that matches the where clause. I don't need the count. And I don't need the documents. And I prefer cosmosDb to stop looking once anything is ...
1
vote
1
answer
79
views
How To Check For Duplicate Objects in a CosmosDB Document
I took over a service at work. This service looks at some data and creates a new version entry in CosmosDB when the data changes.
A psuedo-example of the data is below. The premise is that we have ...
1
vote
1
answer
88
views
Why are updates slow in session consistency and fast in strong consistency in Azure Cosmos Db?
I am using ycsb tool for benchmarking cosmos db in strong vs session consistency level. I have single write region in east us and a replica read region in west us. Container throughput is set to ...
0
votes
1
answer
67
views
How does the .net CosmosDb SDK handle tasks in bulk support?
In the examples for using the bulk support, the tasks created by the SDK are awaited as such:
List<Task> concurrentTasks = new List<Task>();
foreach(Item itemToInsert in ReadYourData())
{
...
0
votes
1
answer
66
views
Azure Cosmos DB NoSQL API | Get Latest Date Created from Duplicate Records
Overview
A record represents the daily sales record of a menu item. The user may upload the same menu item's daily sales record. The latest upload might be their amended sales. We're only interested ...
0
votes
1
answer
135
views
Using camelCase on CosmoDb DbContextOptionBuilder is not working setting output to camelCase and breaks HasPartitionKey
I am setting up a new C# project that needs to connect to an Azure CosmosDb instance. We need to have have all properties in the database be camelCase.
Below is the base class to connect to the db and ...
1
vote
1
answer
129
views
ToListAysnc/ToList taking too long with Azure Cosmos Entity Framework Core
I am using Microsoft.EntityFrameworkCore.Cosmos to fetch results fom Azure CosmosDB. Here is the code.
public async Task<IEnumerable<BookingEntity>> GetAll(string partnerId)
{
var ...
-3
votes
1
answer
163
views
Checking Data in One Cosmos DB Container Before Inserting Into Another
I'm working with Azure Cosmos DB and have a scenario where I need to check for data in one container (e.g., ContainerA) before inserting data into another container (e.g., ContainerB).
I initially ...
0
votes
2
answers
147
views
Azure Cosmos DB REST API using Resource Token gives 403 Forbidden
A resource token is created in cosmos db and when that is used to do REST API Call, CosmosDb gives 403 Unauthorized error.
The same resource token when used in CosmosDb donot sdk, it works.
So ...
0
votes
1
answer
153
views
Cosmos DB query with array
We have looked at the docs and the only main thing we have found is the ARRAY_CONTAINS which does not address our problem as our issue is the inverse of this i.e. whether a string field contains ...
0
votes
1
answer
129
views
Python CosmosDB upsert_item deletes document
I am going to update a document using upsert_item function of CosmosDB Python SDK.
Here is a script:
from dotenv import load_dotenv
from azure.cosmos import CosmosClient
import os
import uuid
def ...
0
votes
1
answer
79
views
Performance impact on using multiple Where function on Cosmos db query
If I have a querable from a Cosmos DB container. What's the performance impact if I write code in these two different ways?
query.Where(x=>x.a=1 && x.b=2);
query.Where(x=>x.a=1).Where(x=...
0
votes
1
answer
63
views
How to formulate query in CosmosDb with pairwise constraints?
Within a container we store some items with the following base and derived classes (simplified):
public abstract class MyItemBase
{
public Guid Id { get; set; }
public string PartitionKey { ...
1
vote
1
answer
146
views
Query all documents in Azure CosmosDB for NoSQL
I am trying to get all documents in a collection in CosmosDB for NoSQL in Azure using Golang but I get null value when trying to do a HTTP GET call to the database.
When I try to pass a specific value ...
0
votes
0
answers
110
views
No partitionKey for items query in Cosmos DB
I noticed that when querying items in a Cosmos DB database, the code sample on Microsoft Docs doesn't require a partitionKey. Why is that? I can certainly imagine scenarios where we may want to run a ...
0
votes
1
answer
144
views
Loop Cosmos DB documents using ADF lookup and foreach
We have more than 5000 documents in the Cosmos DB container. The requirement is to process all of them one by one and import them into another Cosmos DB container.
I tried the ADF lookup and Foreach ...
1
vote
2
answers
142
views
Use Proxy for CosmosDB in .NET
I have proxy problems with my .NET app.
When running it locally behind a corporate proxy I cannot access the Cosmos DB since it receives the calls from my VPN IP and not the whitelisted proxy-server ...
1
vote
1
answer
111
views
Cosmos ChangeFeed date range
I'm working with Azure Cosmos DB NoSQL API and need to reprocess changes from the Change Feed within a specified date range or between two continuation tokens using the Java SDK.
Based on the ...
0
votes
1
answer
56
views
how to find records with duplicates inside a string array is cosmos db
I'm trying to write a cosmos query that return a list of ids, which contain duplicates in a string array that exists on each record.
Here's an example of the dataset I'm working with. using this data, ...
0
votes
1
answer
109
views
Create alias for a parametrized column in the Cosmos DB NoSQL dynamically instead of the name $1,$2,etc
I am writing a sql query where i am getting the key/column name of the SQL query from the user and when i am writing a parameterized query in python then i am getting the key name as $1,$2 instead i ...
0
votes
1
answer
101
views
Problem using where condition in sql string to pass in python to cosmosdb
def run_query(ENDPOINT,KEY, unix_timestamp,token,container_name):
client = CosmosClient(url=ENDPOINT, credential=KEY)
database = client.get_database_client(database_name)
...
0
votes
1
answer
188
views
How to round the result of an AVG in cosmosDB?
How to round the result of an aggregate operation (SUM, AVG, MAX, MIN) in CosmosDB?
After many tries I'm afraid to believe CosmosDb SQL API doesn't allow such types of queries or equivalent
How can I ...