Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.02k stars 1.19k forks source link

Azure Cosmos Db Distinct keyword #24442

Open ssghoda opened 1 year ago

ssghoda commented 1 year ago

I have been using .NET SDK to query Azure Cosmos Db and using DISTINCT keyword in code gives accurate distinct values from a container.

However, using that same query in Azure Portal / Azure Storage Explorer doesn't give accurate results. Sometimes we get same value more than once. I was told in conversation with different team that this is an issue with Azure SDK for Node JS so I was posting the issue here again.

Following are my screenshots for your reference:

image

image

sajeetharan commented 1 year ago

Hi @ssghoda Currently this is a limitation on the SDK, you can find it in our documentation under limitations, we will use this to track and update here.

ssghoda commented 1 year ago

@sajeetharan It would be good to have this so that we get the same query response on Azure Portal / Azure Storage Explorer using JS SDK that we do in code using .NET SDK.

topshot99 commented 1 year ago

Hey @ssghoda,

We have tested several cases in Azure Portal, and the distinct feature worked well for those scenarios. Could you please provide us with more details regarding your container configurations and the size of your current database? This information will greatly assist us in reproducing the issue. cc: @sajeetharan

ssghoda commented 1 year ago

Hi @topshot99 @sajeetharan This issue is still occurring for me. I was told in a related conversation tagged above that Azure Portal / Azure Storage Explorer uses Azure SDK for JS and not Azure SDK for .NET. And it seems JS SDK has this limitation that it can not bring distinct values across partitions. Regarding our container configuration, we have a partition key and around 40 partitions. Total documents will be around 1.8 million and size will be less than 2 GB.

topshot99 commented 1 year ago

@ssghoda Could you also assist us by providing an HAR file that captures the request and response?