I think the problem is that
[{"-ip","-mask"},{"-ip","-mask"}]
won't work. When using the curly brackets and member names (e.g. "-ip", "-mask"), there must be a value associated to each member. Using this value instead should work:
[{"-ip": "a.b.c.d", "-mask": "a.b.c.d" }, {"-ip": "a.b.c.d" ,"-mask": "a.b.c.d" }]
Please also note that in your above query, you will update an attribute named "name", whereas in the example document the attribute name is "-name" (with minus sign in front). To use an attribute name with a minus sign at the beginning, it needs to be quoted in backticks in AQL (see below).
Additionally, the example document has attributes "-name" and "Interface" inside a sub-attribute "Node", whereas the UPDATE command will update attributes "name" and "Interface" on the top level of the document.
I have adjusted the query a bit. The following sequence seems to work from the ArangoShell:
db._create("Node");
db.Node.save({
"_key": "test",
"Node": {
"someAttribute": "someValue",
"-name": "Dev6",
"Interface": [
{
"-ip": "10.20.18.65",
"-mask": "255.255.255.192"
},
{
"-ip": "10.20.18.129",
"-mask": "255.255.255.192"
}
]
}
});
dbs_update_Node_by_key = 'FOR u IN Node FILTER u._key == @key ' +
'UPDATE u WITH { Node: { `-name`: @name, Interface: @Interface } } IN Node';
bind_args = {
key: "test",
name: "Dev8",
Interface: [
{
"-ip": "8.8.8.8",
"-mask": "255.255.255.192"
},
{
"-ip": "192.168.0.1",
"-mask": "255.255.255.255"
}
]
};
db._query(dbs_update_Node_by_key, bind_args);
db.Node.toArray();
This will produce:
[
{
"_id" : "Node/test",
"_key" : "test",
"_rev" : "18996044030550",
"Node" : {
"-name" : "Dev8",
"someAttribute" : "someValue",
"Interface" : [
{
"-ip" : "8.8.8.8",
"-mask" : "255.255.255.192"
},
{
"-ip" : "192.168.0.1",
"-mask" : "255.255.255.255"
}
]
}
}
]
I am not sure if this is what you required, but at least it updates the document and overwrites the "Interface" attribute with new values.