2017-06-29 76 views
0

我在orientdb studio(2.1.12)中有一個JavaScript函數,我試圖用json的屬性是uiJson Document/Class中的embeddedMap類型來更新名爲「node」的字段。請看下面的代碼:問題與更新字段與orientdb中的嵌入式地圖

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 
    }*/ 

打印並返回使用相同的變量節點。而印刷在控制檯它打印使用Java對象的ToString(),而返回它給作爲Json.Please幫我更新場與Json類型的嵌入式地圖。

Error message { 
    "errors": [ 
     { 
      "code": 500, 
      "reason": 500, 
      "content": "com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #0: Error parsing query: \nupdate uiJson set node={0={inputs=[{s_type=URL, source=, v_type=java.lang.String, value=http://www.gmail.com/}], next={0=1}, label=Open Url, type=OPEN_URL, component=FireFox, screenshot=false, chained=false, flowchartElement=startElement_1, top=0.4410876, left=0.12737921}}where @rid=18:1\nEncountered \" <INTEGER_LITERAL> \"0 \"\" at line 1, column 25.\r\nWas expecting one of:\r\n <TO> ...\r\n <VALUES> ...\r\n <SET> ...\r\n <ADD> ...\r\n <PUT> ...\r\n <MERGE> ...\r\n <CONTENT> ...\r\n <REMOVE> ...\r\n <ORDER> ...\r\n <GROUP> ...\r\n <OFFSET> ...\r\n <RECORD> ...\r\n <LUCENE> ...\r\n <NEAR> ...\r\n <WITHIN> ...\r\n <EXCEPTION> ...\r\n <FIND> ...\r\n <REFERENCES> ...\r\n <RECORD_ATTRIBUTE> ...\r\n <CHARACTER_LITERAL> ...\r\n <STRING_LITERAL> ...\r\n \"}\" ...\r\n <IN> ...\r\n <KEY> ...\r\n <IDENTIFIER> ...\r\n <QUOTED_IDENTIFIER> ...\r\n " 
     } 
    ] 
} 
+0

嘗試打印'打印(node.toJSON())' –

+0

已經沒有任何結果嘗試 –

回答

0
childUijson.field("node",node); 
db.save(); 
db.commit(); 

解決我的問題