Skip to content

Commit ef60abc

Browse files
authored
Update ms.date
1 parent 8e57dbb commit ef60abc

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

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

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
11
---
22
title: Access system document properties
3-
titleSuffix: Azure Cosmos DB for Graph
4-
description: Learn how to read and write Azure Cosmos DB system document properties via the API for Gremlin.
3+
titleSuffix: Azure Cosmos DB for Apache Gremlin
4+
description: Learn how to read and write system document properties using Azure Cosmos DB for Apache Gremlin.
5+
author: seesharprun
6+
ms.author: sidandrews
7+
ms.reviewer: mansha
58
ms.service: cosmos-db
69
ms.subservice: apache-gremlin
710
ms.topic: how-to
8-
ms.date: 09/16/2021
9-
author: manishmsfte
10-
ms.author: mansha
11+
ms.date: 02/08/2024
1112
---
1213

13-
# System document properties
14+
# Access system document properties using Azure Cosmos DB for Apache Gremlin
15+
1416
[!INCLUDE[Gremlin](../includes/appliesto-gremlin.md)]
1517

16-
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 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.
1719

18-
```console
20+
`console
1921
g.withStrategies(ProjectionStrategy.build().IncludeSystemProperties('_ts').create())
20-
```
22+
`
2123

2224
## E-Tag
2325

2426
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.
2527

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

3032
## Time-to-live (TTL)
3133

3234
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.
3335

3436
* Use the following command to set time-to-live on a new vertex:
3537

36-
```console
38+
`console
3739
g.addV(<ID>).property('ttl', <expirationTime>)
38-
```
40+
`
3941

4042
For example, a vertex created with the following traversal is automatically deleted after *123 seconds*:
4143

42-
```console
44+
`console
4345
g.addV('vertex-one').property('ttl', 123)
44-
```
46+
`
4547

4648
* Use the following command to set time-to-live on an existing vertex:
4749

48-
```console
50+
`console
4951
g.V().hasId(<ID>).has('pk', <pk>).property('ttl', <expirationTime>)
50-
```
52+
`
5153

5254
* 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:
5355

54-
```console
56+
`console
5557
g.V().hasId(<ID>).has('pk', <pk>).as('v').bothE().hasNot('ttl').property('ttl', <expirationTime>)
56-
```
58+
`
5759

5860
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.
5961

0 commit comments

Comments
 (0)