Skip to content

Commit a008ed0

Browse files
committed
update tab group
1 parent a8260fa commit a008ed0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,20 @@ containerProperties.setComputedProperties(computedProperties);
114114
client.getDatabase("myDatabase").createContainer(containerProperties);
115115
```
116116

117+
### [JavaScript](#tab/javascript)
118+
119+
```javascript
120+
const { resource: contDefinition } = await containerWithComputedProperty.read();
121+
const upperName = {
122+
name: "upperLastName", query: "SELECT VALUE UPPER(IS_DEFINED(c.lastName) ? c.lastName : c.parents[0].familyName) FROM c",
123+
};
124+
if (contDefinition) {
125+
// update computed properties contDefinition.computedProperties = [upperName]; // replace container definition with updated computed properties await containerWithComputedProperty.replace(contDefinition); console.log("Computed properties updated");
126+
} else {
127+
console.log("Container definition is undefined.");
128+
}
129+
```
130+
117131
### [Python](#tab/python)
118132

119133
You can define multiple computed properties in a list and then add them to the container properties. Python SDK currently doesn't support computed properties on existing containers.

0 commit comments

Comments
 (0)