Skip to content

Commit 6736cc6

Browse files
authored
Change code block metadata
1 parent ef60abc commit 6736cc6

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

articles/cosmos-db/gremlin/access-system-properties.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,50 @@ ms.date: 02/08/2024
1515

1616
[!INCLUDE[Gremlin](../includes/appliesto-gremlin.md)]
1717

18-
Azure Cosmos DB has [system properties](/rest/api/cosmos-db/databases) such as `_ts`, `_self`, `_attachments`, `_rid`, and `_etag` on every document. Additionally, Gremlin engine adds `inVPartition` and `outVPartition` properties on edges. By default, these properties are available for traversal. However, it's possible to include specific properties, or all of them, in Gremlin traversal.
18+
Azure Cosmos DB for Gremlin has [system properties](/rest/api/cosmos-db/databases) such as `_ts`, `_self`, `_attachments`, `_rid`, and `_etag` on every item. Additionally, Gremlin engine adds `inVPartition` and `outVPartition` properties on edges. By default, these properties are available for traversal. However, it's possible to include specific properties, or all of them, in Gremlin traversal.
1919

20-
`console
20+
```gremlin
2121
g.withStrategies(ProjectionStrategy.build().IncludeSystemProperties('_ts').create())
22-
`
22+
```
2323

2424
## E-Tag
2525

26-
This property is used for optimistic concurrency control. If application needs to break operation into a few separate traversals, it can use eTag property to avoid data loss in concurrent writes.
26+
This property is used for optimistic concurrency control. If an application needs to break an operation into separate traversals, use the eTag property to avoid data loss in concurrent writes.
2727

28-
`console
28+
```gremlin
2929
g.withStrategies(ProjectionStrategy.build().IncludeSystemProperties('_etag').create()).V('1').has('_etag', '"00000100-0000-0800-0000-5d03edac0000"').property('test', '1')
30-
`
30+
```
3131

3232
## Time-to-live (TTL)
3333

34-
If collection has document expiration enabled and documents have `ttl` property set on them, then this property is available in Gremlin traversal as a regular vertex or edge property. `ProjectionStrategy` isn't necessary to enable time-to-live property exposure.
34+
If a graph has document expiration enabled and documents have `ttl` property set on them, then this property is available in Gremlin traversal as a regular vertex or edge property. `ProjectionStrategy` isn't necessary to enable time-to-live property exposure.
3535

36-
* Use the following command to set time-to-live on a new vertex:
36+
- Use the following command to set time-to-live on a new vertex:
3737

38-
`console
39-
g.addV(<ID>).property('ttl', <expirationTime>)
40-
`
38+
```gremlin
39+
g.addV(<ID>).property('ttl', <expirationTime>)
40+
```
4141
42-
For example, a vertex created with the following traversal is automatically deleted after *123 seconds*:
42+
For example, a vertex created with the following traversal is automatically deleted after *123 seconds*:
4343
44-
`console
45-
g.addV('vertex-one').property('ttl', 123)
46-
`
44+
```gremlin
45+
g.addV('vertex-one').property('ttl', 123)
46+
```
4747
48-
* Use the following command to set time-to-live on an existing vertex:
48+
- Use the following command to set time-to-live on an existing vertex:
4949
50-
`console
51-
g.V().hasId(<ID>).has('pk', <pk>).property('ttl', <expirationTime>)
52-
`
50+
```gremlin
51+
g.V().hasId(<ID>).has('pk', <pk>).property('ttl', <expirationTime>)
52+
```
5353
54-
* Applying time-to-live property on vertices doesn't automatically apply it to edges. Because edges are independent records in the database store. Use the following command to set time-to-live on vertices and all the incoming and outgoing edges of the vertex:
54+
- Applying the time-to-live property on vertices doesn't automatically apply it to associated edges. This behavior occurs because edges are independent records in the database store. Use the following command to set time-to-live on vertices and all the incoming and outgoing edges of the vertex:
5555
56-
`console
57-
g.V().hasId(<ID>).has('pk', <pk>).as('v').bothE().hasNot('ttl').property('ttl', <expirationTime>)
58-
`
56+
```gremlin
57+
g.V().hasId(<ID>).has('pk', <pk>).as('v').bothE().hasNot('ttl').property('ttl', <expirationTime>)
58+
```
5959
60-
You can set time to Live (TTL) on the container to -1 or set it to **On (no default)** from Azure portal, then the TTL is infinite for any item unless the item has TTL value explicitly set.
60+
> [!NOTE]
61+
> You can set time to Live (TTL) on the container to `-1` or to **On (no default)** from the Azure portal. Then, the TTL is infinite for any item unless the item has a TTL value explicitly set.
6162
6263
## Next step
6364

0 commit comments

Comments
 (0)