You manage the product container in the cosmicworks database of an Azure Cosmos DB for NoSQL account. The container already has one computed property, cp_primaryCategory, which is indexed and used by existing queries.
You must add a computed property named cp_lowerName with the query SELECT VALUE LOWER(c.name) FROM c, and then run this report:
SELECT c.id, c.cp_lowerName FROM c ORDER BY c.cp_lowerName
Requirements:
cp_primaryCategorymust keep working.- You make all changes in Data Explorer in the Azure portal.
Which actions should you perform, in order?
You didn't answer this one.
cp_lowerName definition to the existing JSON array next to cp_primaryCategory, and select Save.{ "path": "/cp_lowerName/?" } to includedPaths and select Save./cp_lowerName/? to finish.ORDER BY c.cp_lowerName.Save both computed property definitions to preserve cp_primaryCategory. Then explicitly include /cp_lowerName/?, because wildcard indexing does not cover computed properties. Wait for index transformation to finish before running the report, since ORDER BY requires the computed property's index.
- Step 1: In Data Explorer, open the container's Settings, go to Computed Properties, add the
cp_lowerNamedefinition to the existing JSON array next tocp_primaryCategory, and select Save. Define the new property before explicitly indexing its path, and retain the existing definition so thatcp_primaryCategorycontinues working. - Step 2: In the container's Indexing Policy settings, add
{ "path": "/cp_lowerName/?" }toincludedPathsand select Save. The definition must exist before its path is explicitly indexed. Computed properties need an explicit included path because the/*wildcard does not cover them. - Step 3: Wait for the index transformation that adds
/cp_lowerName/?to finish. Saving the policy starts the indexing change; the new index must finish building before the report can use it. - Step 4: Run the report query that uses
ORDER BY c.cp_lowerName. The completed transformation provides the index required to order results by the computed property. - Not needed: Rely on the existing
/*included path to indexcp_lowerName. The/*wildcard does not cover computed properties, so the ORDER BY query would still fail without an explicit path. - Not needed: Replace the existing Computed Properties array entry with the
cp_lowerNamedefinition and select Save. Replacing the entry removes thecp_primaryCategorydefinition required by existing queries. - Not needed: Add a spatial index on
/cp_lowerName/*. A computed property can't have a spatial index, and a spatial index would not support the report's ORDER BY.