2016-10-24 41 views
0

「導出查詢」不在Query tab of the Web Interface工作,所以我試圖與查詢手動創建JSON和導入,但下面的定義不明確:如何在ArangoDB的Web界面中「導入查詢」?

Format: 
JSON documents embedded into a list: 

[{ 
    "name": "Query Name", 
    "value": "Query Definition", 
    "parameter": "Query Bind Parameter as Object" 
}] 

應該有value什麼逃逸,是否parameter是強制性的,在定義了多個綁定參數的情況下,格式是什麼。

我無法導入下面的腳本:

[{ 
    name: "Create Random Complex Users (num, outpUsers)", 
    value: '// Create specified number of users in the users Vertex collection 
FOR i IN [email protected] 
    INSERT { 
    id: 100000 + i, 
    age: 18 + FLOOR(RAND() * 50), // RAND generate float E {0, 1] 
    name: CONCAT('user', TO_STRING(i)), 
    } IN @@users' 
} 
] 

什麼是錯的,究竟應該如何固定?

注: ArangoDB版本:arangosh (ArangoDB 3.0.10 [linux] 64bit, using VPack 0.1.30, ICU 54.1, V8 5.0.71.39, OpenSSL 1.0.1f 6 Jan 2014)

使用@ mpv1989出現在Web Inetface以下錯誤固定JSON:Query error: queries could not be imported。 而下面的消息是使用數據庫日誌中名爲root用戶下test

2016-10-26T12:31:28Z [31690] ERROR Service "/_admin/aardvark" encountered error 500 while handling POST http://localhost:8529/_db/test/_admin/aardvark/query/upload/root 
2016-10-26T12:31:28Z [31690] ERROR ArangoError: users can only be used in _system database 
2016-10-26T12:31:28Z [31690] ERROR  at getStorage (/usr/share/arangodb3/js/server/modules/@arangodb/users.js:93:17) 
2016-10-26T12:31:28Z [31690] ERROR  at Object.exports.document (/usr/share/arangodb3/js/server/modules/@arangodb/users.js:291:17) 
2016-10-26T12:31:28Z [31690] ERROR  at Route._handler (/usr/share/arangodb3/js/apps/system/_admin/aardvark/APP/aardvark.js:153:18) 
2016-10-26T12:31:28Z [31690] ERROR  at next (/usr/share/arangodb3/js/server/modules/@arangodb/foxx/router/tree.js:386:15) 
2016-10-26T12:31:28Z [31690] ERROR  at /usr/share/arangodb3/js/node/node_modules/lodash/lodash.js:9378:25 
2016-10-26T12:31:28Z [31690] ERROR  at Middleware.authRouter.use (/usr/share/arangodb3/js/apps/system/_admin/aardvark/APP/aardvark.js:78:3) 
2016-10-26T12:31:28Z [31690] ERROR  at next (/usr/share/arangodb3/js/server/modules/@arangodb/foxx/router/tree.js:388:15) 
2016-10-26T12:31:28Z [31690] ERROR  at next (/usr/share/arangodb3/js/server/modules/@arangodb/foxx/router/tree.js:384:7) 
2016-10-26T12:31:28Z [31690] ERROR  at next (/usr/share/arangodb3/js/server/modules/@arangodb/foxx/router/tree.js:384:7) 
2016-10-26T12:31:28Z [31690] ERROR  at next (/usr/share/arangodb3/js/server/modules/@arangodb/foxx/router/tree.js:384:7) 

但是,固定JSON可以成功地導入到數據庫_SYSTEM!謝謝@ mpv1989。
看起來,查詢片段的持久性和導入僅適用於_SYSTEM數據庫...

+0

你使用哪個ArangoDB版本? – mpv1989

+0

從他們的網站Ubuntu的最新版本:「ArangoDB 3.0.10 [linux] 64bit,使用VPack 0.1.30,ICU 54.1,V8 5.0.71.39,OpenSSL 1.0.1f 2014年1月6日」 – luart

回答

1

導出/導入時會得到什麼錯誤消息?

爲了解決您的問題,我從Web界面導出了您的查詢。結果如下:

[{ 
    "name": "Create Random Complex Users (num, outpUsers)", 
    "value": "// Create specified number of users in the users Vertex collection\nFOR i IN [email protected]\n INSERT {\n id: 100000 + i,\n age: 18 + FLOOR(RAND() * 50), // RAND generate float E {0, 1]\n name: CONCAT('user', TO_STRING(i))\n } IN @@users", 
    "parameter": { 
     "usersNum": 100, 
     "@users": "users" 
    } 
}] 

該字段parameter是一個Json對象。如果你沒有任何綁定參數,只需寫一個空對象"parameter": {}

+0

謝謝@ mpv1989,this JSON是可導出的!不幸的是,它只能用於_SYSTEM數據庫(請參閱上面的錯誤日誌)...... – luart