我在orientdb studio(2.1.12)中有一个javascript函数,我正在尝试使用json更新名为“node”的字段,json的属性在uiJson Document / Class中的embeddedMap类型。找到下面的代码:
>>> import numpy as np
>>> tab1 = np.array([[0,1.,0],[1.,1.,1.],[0,1.,0]])
>>> tab2 = np.array([[1.,1.,0],[1.,0.,1.],[0,1.,1.]])
>>> tab2[np.where(tab1==1.)] = 2.0
>>> tab2
array([[ 1., 2., 0.],
[ 2., 2., 2.],
[ 0., 2., 1.]])
打印并返回使用相同的变量节点。在控制台中打印时,使用java对象tostring()打印,同时返回它给出Json.Please帮我更新类型为Json的字段嵌入式地图。
var dt = db.query("SELECT * from uijson");
childUijson = dt[0].getRecord();
node = childUijson.field('node');
print(node )
db.command('update uiJson set node=' + node + 'where @rid=18:1');
return node;
/*Print in oriendb console{0=inputs[{s_type=URL,source=,v_type=java.l,value=http://www.gmail.com}], next={0=1}, label=Open Url, type=OPEN_URL, component=FireFox, screenshot=false,chained=false,flowchartElement=startElement_1,left=0.12737921}}
*/
/*Return statement {
"0": {
"inputs": [
{
"s_type": "URL",
"source": "",
"v_type": "java.lang.String",
"value": "http://localhost:8090/Automaton/"
}
],
"next": {
"0": "1"
},
"label": "Open Url",
"type": "OPEN_URL",
"component": "FireFox",
"screenshot": false,
"chained": false,
"flowchartElement": "startElement_1",
"top": 0.4410876,
"left": 0.12737921
}
"@type": "d",
"@version": 0
}*/
答案 0 :(得分:0)
childUijson.field("node",node);
db.save();
db.commit();
解决了我的问题