ComputedProperty Class
- java.
lang. Object - com.
azure. cosmos. models. ComputedProperty
- com.
public final class 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
Constructor | Description |
---|---|
ComputedProperty(String name, String query) |
Instantiates a new Computed properties with name and query. |
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
getName()
Gets the name of the computed property. |
String |
getQuery()
Gets the query used to evaluate the value for the computed property. |
Methods inherited from java.lang.Object
Constructor Details
ComputedProperty
public ComputedProperty(String name, String query)
Instantiates a new Computed properties with name and query.
Parameters:
Method Details
getName
public String getName()
Gets the name of the computed property.
Returns:
getQuery
public String getQuery()
Gets the query used to evaluate the value for the computed property.
Returns:
Applies to
Azure SDK for Java