Skip to content

Commit 28b6ee0

Browse files
Merge pull request #256947 from jcodella/patch-1
Update computed-properties on reindexing and unsupported functions
2 parents cf1aad2 + 2453585 commit 28b6ee0

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

articles/cosmos-db/nosql/query/computed-properties.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ The constraints on computed property names are:
6060

6161
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.
6262

63-
The constraints on computed property query definitions are:
63+
The limitations on computed property query definitions are:
6464

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`.
6666
- 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.
6870
- 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.
7072

7173
## Create computed properties
7274

@@ -304,6 +306,15 @@ There are a few considerations for indexing computed properties, including:
304306
> [!NOTE]
305307
> All computed properties are defined at the top level of the item. The path is always `/<computed property name>`.
306308
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+
307318
### Add a single index for computed properties
308319

309320
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
366377
## Related content
367378

368379
- [Manage indexing policies](../how-to-manage-indexing-policy.md)
369-
- [Model document data](../../modeling-data.md)
380+
- [Model document data](../../modeling-data.md)

0 commit comments

Comments
 (0)