Package com.azure.cosmos.models
Class ComputedProperty
java.lang.Object
com.azure.cosmos.models.ComputedProperty
Represents a computed property definition for a Cosmos DB container.
Below is an example of how to use
ComputedProperty in the context of creating a container.
List<ComputedProperty> computedProperties = new ArrayList<>(
Arrays.asList(
new ComputedProperty("lowerName", "SELECT VALUE LOWER(c.name) FROM c")
)
);
containerProperties.setComputedProperties(computedProperties);
database.createContainer(containerProperties).subscribe();
Below is an example of how to use ComputedProperty in the context of replacing a container.
CosmosContainerProperties containerProperties = getCollectionDefinition(containerName);
List<ComputedProperty> computedProperties = new ArrayList<>(
Arrays.asList(
new ComputedProperty("upperName", "SELECT VALUE UPPER(c.name) FROM c")
)
);
containerProperties.setComputedProperties(computedProperties);
container = database.getContainer(containerName);
container.replace(containerProperties).subscribe();
-
Constructor Summary
ConstructorsConstructorDescriptionComputedProperty(String name, String query) Instantiates a new Computed properties with name and query. -
Method Summary
-
Constructor Details
-
ComputedProperty
Instantiates a new Computed properties with name and query.- Parameters:
name- the name of the computed property.query- the query used to evaluate the value for the computed property.
-
-
Method Details
-
getName
Gets the name of the computed property.- Returns:
- the name of the computed property.
-
getQuery
Gets the query used to evaluate the value for the computed property.- Returns:
- the query for the computed property.
-