系统文档属性System document properties

Azure Cosmos DB 具有与每个文档有关的系统属性,例如 _ts_self_attachments_rid_etagAzure Cosmos DB has system properties such as _ts, _self, _attachments, _rid, and _etag on every document. 此外,Gremlin 引擎会添加与边缘有关的 inVPartitionoutVPartition 属性。Additionally, Gremlin engine adds inVPartition and outVPartition properties on edges. 默认情况下,这些属性可供遍历。By default, these properties are available for traversal. 但是,可将特定属性或所有这些属性都包含在 Gremlin 遍历中。However, it's possible to include specific properties, or all of them, in Gremlin traversal.

g.withStrategies(ProjectionStrategy.build().IncludeSystemProperties('_ts').create())

E-TagE-Tag

此属性用于执行乐观并发控制。This property is used for optimistic concurrency control. 如果应用程序需要将操作分为几个不同的遍历,则可以使用 eTag 属性避免并发写入时的数据丢失。If application needs to break operation into a few separate traversals, it can use eTag property to avoid data loss in concurrent writes.

g.withStrategies(ProjectionStrategy.build().IncludeSystemProperties('_etag').create()).V('1').has('_etag', '"00000100-0000-0800-0000-5d03edac0000"').property('test', '1')

生存时间 (TTL)Time-to-live (TTL)

如果集合已启用文档过期,并且文档上设置了 ttl 属性,则此属性将在 Gremlin 遍历中可用作常规的顶点或边缘属性。If collection has document expiration enabled and documents have ttl property set on them, then this property will be available in Gremlin traversal as a regular vertex or edge property. 启用生存时间属性曝光不需要 ProjectionStrategyProjectionStrategy isn't necessary to enable time-to-live property exposure.

通过以下遍历创建的顶点将在 123 秒后自动删除。Vertex created with the traversal below will be automatically deleted in 123 seconds.

g.addV('vertex-one').property('ttl', 123)

后续步骤Next steps