javascript-ArangoDB / FOXX存储库问题
作者:互联网
我正在ArangoDB的FOXX应用程序上的存储库中尝试自定义查询:
/*clinics.js */
'use strict';
var Foxx = require('org/arangodb/foxx');
var ClinicsRepository = Foxx.Repository.extend({
// Add your custom methods here
//Returns 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']
})
});
exports.repository = ClinicsRepository;
I did this following the Foxx cookbook, but it always gives me an
error:[ArangoError 3103: failed to invoke module File:
c:/Program Files/ArangoDB
2.6.2/var/lib/arangodb-apps/_db/_system/exameFacil/APP/controllers/clinics.js]06001
每当我尝试“要求” cliparts.js文件时,都会发生此错误.有什么建议么?谢谢!
解决方法:
你能尝试换行吗
exports.repository = ClinicsRepository;
至
module.exports = ClinicsRepository;
然后错误应该消失.
除此之外,可能需要将AQL查询中的过滤器从
FILTER clinic._key == [@id]
至
FILTER clinic._key == @id
要么
FILTER clinic._key IN @id
实际查找文档,具体取决于您要查找单个文档还是文档数组.
标签:arangodb,javascript,foxx 来源: https://codeday.me/bug/20191028/1949345.html