简体   繁体   English

CosmosDB图形:如何使用gremlin更新具有多个值的属性的顶点?

[英]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.

相关问题 CosmosDB图:如何使用gremlin更新具有多个值的顶点的属性值? - CosmosDB Graph: How to update a value of property of vertex having multiple values using gremlin? Azure cosmosDB gremlin - 如何使用另一个顶点的属性更新顶点属性 - Azure cosmosDB gremlin - how to update vertex property with another vertex's property Neptune,Python,Gremlin:使用值数组更新图形顶点中的属性 - Neptune, Python, Gremlin: Update a property in a graph vertex with an array of values gremlin - 如何使用另一个顶点的属性更新顶点属性 - gremlin - how to update vertex property with another vertex's property 如何使用Gremlin从CosmosDB图生成自定义JSON输出? - How to generate a custom JSON output from a CosmosDB Graph using Gremlin? 如何使用 graph.OpenManagement() 获取顶点标签 gremlin 的模式 - How to get schema of a vertex label gremlin using graph.OpenManagement() 如何使用 Gremlin 检查图形中是否存在节点/顶点/边 - How to check the node/vertex/Edge is present in the Graph using Gremlin 如何使用 azure cosmosDB gremlin 设置故事的顶点和边缘? - How do I set up the vertex and edge of the story using azure cosmosDB gremlin? Gremlin 查询查找重复项和更新顶点属性 - Gremlin query for find duplicates and update vertex property Gremlin 查询以更新顶点属性(如果存在)或创建具有属性的新顶点 - Gremlin query to update the vertex property if exists or create new vertex with property
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM