SELECT VALUE for scalar aggregates and indexer custom queries

Verdict: Pair an aggregate with SELECT VALUE to get a raw scalar instead of a wrapped object. Cosmos DB indexer custom queries must ORDER BY c._ts and use SELECT VALUE projection; DISTINCT and GROUP BY are unsupported there.

CriterionSELECT COUNT(1)SELECT VALUE COUNT(1)
Result shapeWrapped object like [{"$1": 42}]Raw scalar like 42
Use forWhen a property-name wrapper is acceptableBinding a single KPI number directly to a UI element

Rules

Traps