[英]CosmosDB Graph: How to update vertex having property with multiple values using gremlin?
According to cosmosDB graph documentation, a vertex can have property with multiple values. 根据cosmosDB图形文档,一个顶点可以具有带有多个值的属性。 https://docs.microsoft.com/en-us/azure/cosmos-db/gremlin-support https://docs.microsoft.com/en-us/azure/cosmos-db/gremlin-support
So while adding vertex if we define multiple values for a property, it gets added. 因此,在添加顶点的过程中,如果我们为一个属性定义了多个值,则会添加它。
Suppose my query is : 假设我的查询是:
g.addV('employee').property('id', 'john').property('country', 'USA').property('country', 'India')
Result is: 结果是:
[{"id":"john","label":"employee","type":"vertex","properties":{"country":
[{"id":"5dc2aaf6-cb11-4d4a-a2ce-e5fe79d28c80","value":"USA"},
{"id":"fcf4baf6-b4d5-45a3-a4ba-83a859806aef","value":"India"}]}}]
But while updating vertex, if we update a property with multiple values. 但是在更新顶点时,如果我们更新具有多个值的属性。
Query is: 查询是:
g.V('john').property('country', 'USA').property('country', 'India').property('country', 'China')
Result is: 结果是:
[{"id":"john","label":"employee","type":"vertex","properties":{"country":
[{"id":"7e5d9847-31e5-4a59-82f9-b78e744420a1","value":"China"}]}}]
How to update this property with multiple values? 如何用多个值更新此属性?
You're missing the list
keyword that will allow you to add additional properties. 您缺少允许您添加其他属性的list
关键字。
I'd recommend reading the Tinkerpop docs on VertexProperties 我建议阅读VertexProperties上的Tinkerpop文档
g.V('john').property(list, 'country', 'USA')
.property(list, 'country', 'India')
.property(list, 'country', 'China')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.