title | titleSuffix | description | author | ms.author | ms.reviewer | ms.service | ms.subservice | ms.topic | ms.devlang | ms.date | ms.custom |
---|---|---|---|---|---|---|---|---|---|---|---|
MIN |
Azure Cosmos DB for NoSQL |
An Azure Cosmos DB for NoSQL system function that returns the minimum value. |
jcodella |
jacodel |
sidandrews |
cosmos-db |
nosql |
reference |
nosql |
02/27/2024 |
query-reference |
[!INCLUDENoSQL]
Returns the minimum of the values in the expression.
MIN(<scalar_expr>)
Description | |
---|---|
scalar_expr |
A scalar expression. |
Returns a numeric scalar value.
This example uses a container with multiple items that each have a /price
numeric field.
:::code language="json" source="~/cosmos-db-nosql-query-samples/scripts/min/seed.json" range="1-2,4-8,10-14" highlight="3,8":::
For this example, the MIN
function is used in a query that includes the numeric field that was mentioned.
:::code language="nosql" source="~/cosmos-db-nosql-query-samples/scripts/min/query.sql" highlight="2":::
:::code language="json" source="~/cosmos-db-nosql-query-samples/scripts/min/result.json":::
- This function benefits from a range index.
- The arguments in
MIN
can be number, string, boolean, or null. - Any
undefined
values are ignored. - The following priority order is used (in ascending order), when comparing different types of data:
- null
- boolean
- number
- string