azure-cosmos-db-emulator-docker icon indicating copy to clipboard operation
azure-cosmos-db-emulator-docker copied to clipboard

Query with VALUE COUNT(1) does not work

Open jvalkeejarvi opened this issue 11 months ago • 5 comments

Following query does not work.

SELECT VALUE COUNT(1) FROM c

Cosmos SDK uses queries with VALUE COUNT(1) when using CountAsync method with an IQueryable.

jvalkeejarvi avatar Dec 17 '24 20:12 jvalkeejarvi

Do you happen to have the exception you received when you tried this and it didn't work?

christopheranderson avatar Jan 07 '25 19:01 christopheranderson

I get the following error when using Cosmos explorer in browser: Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM c -> SELECT COUNT(1) FROM %s AS c

jvalkeejarvi avatar Jan 08 '25 07:01 jvalkeejarvi

We don't support that flavor of aggregation yet. Stay tuned...

xgerman avatar Jan 21 '25 19:01 xgerman

Unfortunately this is the flavour of aggregation you get from LINQ to NoSql translation, so my code still won't work with the current build. :(

RichMercer avatar Feb 05 '25 20:02 RichMercer

What is the situation with this issue? This is a really bad blocker as Cosmos SDK uses this kind of COUNT query.

jvalkeejarvi avatar Apr 30 '25 06:04 jvalkeejarvi

Hi! I am also having this issue with the cosmos vnext emulator. Is there any expected date for this feature?

Pacopb-itx avatar May 22 '25 11:05 Pacopb-itx

We will investigate if there is an easy fix not involving the query engine (see https://github.com/Azure/azure-cosmos-db-emulator-docker/discussions/200) We will keep you posted.

xgerman avatar May 22 '25 21:05 xgerman

@RichMercer @jvalkeejarvi @Pacopb-itx We added support to this query style in our last release https://github.com/Azure/azure-cosmos-db-emulator-docker/releases/tag/EN20250612 . Please let us know if you have further issues (reopen this issue or open another one).

lionelc avatar Jun 24 '25 16:06 lionelc

We published a fix and will close this issue. Please reopen if you have still problems

xgerman avatar Jun 24 '25 16:06 xgerman