Gremlin (with Orient Backend): Can't commit update to embedded array

28 views
Skip to first unread message

Ivan Plaza

unread,
Mar 24, 2015, 3:44:35 PM3/24/15
to gremli...@googlegroups.com
Hi

I'm having an issue committing changes to an array field with gremlin and orientdb. It seems updates to embedded lists are ignored.

I have an edge that contains an array. If I push a new value to the array and commit the change, the new value does not show in the database.

However, if I push a new value to the array and also set another field, then commit, the array values appear.

Here's the sequence:

(create 2 vertices)
gremlin> v1 = g.addVertex();
==>v[#-1:-2]
gremlin> v2 = g.addVertex();
==>v[#-1:-3]
gremlin> g.commit()
==>null

(create the edge between two vertices with array)
g.addEdge(v1,v2,"Friend",["array":["one"]])
gremlin> g.e("#13:0")                    
==>e[#13:0][#9:3-Friend->#9:4]

(now push a new value to the array and commit the change)
gremlin> g.e("#13:0").getProperty("array").push("two")
==>true
gremlin> g.e("#13:0").getProperty("array")           
==>one
==>two
gremlin> g.commit()

(now reconnect to see if the update was saved)
gremlin> g = new OrientGraph("remote:/orientdb-community-2.0.5/databases/test");
gremlin> g.e("#13:0").map                                                                     
==>{array=[one]}
(nope, array only has one value)

(now lets try updating the array and another field)
gremlin> g.e("#13:0").getProperty("array").push("two")                                        
==>true
gremlin> g.e("#13:0").map                            
==>{array=[one, two]}
gremlin> g.e("#13:0").delta=1
==>1
gremlin> g.commit()                                                                           
==>null

(now reconnect )
gremlin> g = new OrientGraph("remote:/orientdb-community-2.0.5/databases/test");
==>orientgraph[remote:/Users/yvan/dev/orientdb-community-2.0.5/databases/test]
gremlin> g.e("#13:0").map                                                                     
==>{array=[one, two], delta=1}
(yep, we got two values now but we were forced to set another field)

Any ideas ??
I posted this in both orientdb and gremlin groups as I dont know where the issue lies
Gremlin Version: 2.6.0
OrientDB Version: 2.0.5

Ivan Plaza

unread,
Mar 25, 2015, 7:13:41 PM3/25/15
to gremli...@googlegroups.com
This was answered in the orientdb group.
Reply all
Reply to author
Forward
0 new messages