OrientDB从集合中删除所有值
我注意到,OrientDB从集合中删除所有值,orientdb,Orientdb,我注意到,updateclass REMOVE field=“item”查询只删除一个匹配的项- 是否有办法删除所有匹配的值 例如[“item1”、“item2”、“item2”、“item2”]=>[“item1”] 混合:[{“test”:“1”},“item”,“item”]=>[{“test”:1}]在javascript中尝试此函数: var g=orient.getGraph(); var b=g.command("sql","select from Person"); for(j=
updateclass REMOVE field=“item”
查询只删除一个匹配的项-
是否有办法删除所有匹配的值
例如[“item1”、“item2”、“item2”、“item2”]
=>[“item1”]
混合:
[{“test”:“1”},“item”,“item”]
=>[{“test”:1}]
在javascript中尝试此函数:
var g=orient.getGraph();
var b=g.command("sql","select from Person");
for(j=0;j<b.length;j++)
{
var array=[];
var list= b[j].getProperty("items");
for(i=0;i<list.length;i++)
{
if(list[i]!=item)
{
array.push(list[i]);
}
b[j].setProperty("items",array);
}
}
问候,,
米歇尔试试这个查询
update class set field = field.removeAll("item2")
您是否尝试过更新类删除字段名,如“item%”@lasithaweerasing出现
错误时遇到了错误-您在集合中保留了什么?我的意思是它们是字符串,还是任何comlplex fata类型的字符串和文档/对象。好的。对不起,我刚才误解了你的问题。。。看起来orientdb使用remove命令一次从集合中删除一个。。可能他们对您的要求有不同的命令
update class set field = field.removeAll("item2")