这个查询:
FOR clinic IN exameFacil_clinics
LET procedures_list = (
FOR procedure IN clinic.procedures
FILTER LIKE(procedure.name, "%hemo%", true)
COLLECT procedures_list = procedure.name
RETURN procedures_list
)
FILTER LENGTH(procedures_list) > 0
RETURN{
clinic_name: clinic.name,
procedures_list: procedures_list}
在 AQL 编辑器的 ArangoDB 的 Web 界面中执行时工作正常并返回预期结果,但是当我尝试在 FOXX 存储库中执行时给我一个错误:
'use strict';
var Foxx = require('org/arangodb/foxx');
module.exports = Foxx.Repository.extend({
// Add your custom methods here
//Return all procedures from a clinic, given the clinic id
getAllProcedures: Foxx.createQuery({
query: 'FOR clinic IN exameFacil_clinics FILTER clinic._key == @id RETURN clinic.procedures',
params: ['id']
}),
//Make a 'LIKE' query in all procedures from all clinics, given the search string ( procedure name )
searchProcedure: Foxx.createQuery({
query: 'FOR clinic IN exameFacil_clinics
LET procedures_list = (
FOR procedure IN clinic.procedures
FILTER LIKE(procedure.name, "%hemo%", true)
COLLECT procedures_list = procedure.name
RETURN procedures_list
)
FILTER LENGTH(procedures_list) > 0
RETURN{
clinic_name: clinic.name,
procedures_list: procedures_list}'
}),
});
错误:
[ArangoError 3103: 调用模块文件失败:c:/Program Files/ArangoDB 2.6.2/var/lib/arangodb-apps/_db/_system/exameFacil/APP/controllers/clinics.js] 在 [object Object].Module .run (C:\Program Files\ArangoDB 2.6.2\bin../share/arangodb/js/common/bootstrap/modules.js:1420:20) 在 ArangoApp.loadAppScript (c:/Program Files/ArangoDB 2.6. 2/share/arangodb/js/server/modules/org/arangodb/foxx/arangoApp.js:452:24) 在 mountController (c:/Program Files/ArangoDB 2.6.2/share/arangodb/js/server/modules/ org/arangodb/foxx/routing.js:661:7) 在 c:/Program Files/ArangoDB 2.6.2/share/arangodb/js/server/modules/org/arangodb/foxx/routing.js:630:9 在Array.forEach (native) at routeApp (c:/Program Files/ArangoDB 2.6.2/share/arangodb/js/server/modules/org/arangodb/foxx/routing.js:629:32) 在 Object.routes (c :/程序文件/ArangoDB 2.6。2/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:268:10) 在 foxxRouting (c:/Program Files/ArangoDB 2.6.2/share/arangodb/js/server/modules/ org/arangodb/actions.js:1054:74) 在对象处执行 (c:/Program Files/ArangoDB 2.6.2/share/arangodb/js/server/modules/org/arangodb/actions.js:1308:7) .routeRequest (c:/Program Files/ArangoDB 2.6.2/share/arangodb/js/server/modules/org/arangodb/actions.js:1329:3) 在 Function.actions.defineHttp.callback (c:\ \ArangoDB 2.6.2\share\arangodb\js\actions\api-system.js:58:15)在 Function.actions.defineHttp.callback (c:\Program Files\ ArangoDB 2.6.2\share\arangodb\js\actions\api-system.js:58:15)在 Function.actions.defineHttp.callback (c:\Program Files\ ArangoDB 2.6.2\share\arangodb\js\actions\api-system.js:58:15)
有什么建议吗?谢谢