You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/nosql/query/computed-properties.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,13 +60,15 @@ The constraints on computed property names are:
60
60
61
61
Queries in the computed property definition must be valid syntactically and semantically, otherwise the create or update operation fails. Queries should evaluate to a deterministic value for all items in a container. Queries may evaluate to undefined or null for some items, and computed properties with undefined or null values behave the same as persisted properties with undefined or null values when used in queries.
62
62
63
-
The constraints on computed property query definitions are:
63
+
The limitations on computed property query definitions are:
64
64
65
-
- Queries must specify a FROM clause that represents the root item reference. Examples of supported FROM clauses are `FROM c`, `FROM root c`, and `FROM MyContainer c`.
65
+
- Queries must specify a FROM clause that represents the root item reference. Examples of supported FROM clauses are:`FROM c`, `FROM root c`, and `FROM MyContainer c`.
66
66
- Queries must use a VALUE clause in the projection.
67
-
- Queries can't use any of the following clauses: WHERE, GROUP BY, ORDER BY, TOP, DISTINCT, OFFSET LIMIT, EXISTS, ALL, and NONE.
67
+
- Queries can't include a JOIN.
68
+
- Queries can't use non-deterministic Scalar expressions. Examples of non-deterministic scalar expressions are: GetCurrentDateTime, GetCurrentTimeStamp, GetCurrentTicks, and RAND.
69
+
- Queries can't use any of the following clauses: WHERE, GROUP BY, ORDER BY, TOP, DISTINCT, OFFSET LIMIT, EXISTS, ALL, LAST, FIRST, and NONE.
68
70
- Queries can't include a scalar subquery.
69
-
- Aggregate functions, spatial functions, nondeterministic functions, and user defined functions aren't supported.
71
+
- Aggregate functions, spatial functions, nondeterministic functions, and user defined functions (UDFs) aren't supported.
70
72
71
73
## Create computed properties
72
74
@@ -304,6 +306,15 @@ There are a few considerations for indexing computed properties, including:
304
306
> [!NOTE]
305
307
> All computed properties are defined at the top level of the item. The path is always `/<computed property name>`.
306
308
309
+
> [!TIP]
310
+
> Every time you update container properties, the old values are overwritten. If you have existing computed properties and want to add new ones, be sure that you add both new and existing computed properties to the collection.
311
+
312
+
>![NOTE]
313
+
> When the definition of an indexed computed property is modified, it's not automatically reindexed. To index the modified computed property, you'll first need to drop the computed property from the index. Then after the reindexing is completed, add the computed property back to the index policy.
314
+
>
315
+
> If you want to delete a computed property, you'll first need to remove it from the index policy.
316
+
317
+
307
318
### Add a single index for computed properties
308
319
309
320
To add a single index for a computed property named `cp_myComputedProperty`:
@@ -366,4 +377,4 @@ Adding computed properties to a container doesn't consume RUs. Write operations
0 commit comments