gpt4 book ai didi

javascript - ArangoDB/FOXX 存储库问题

转载 作者:行者123 更新时间:2023-11-29 10:12:01 25 4
gpt4 key购买 nike

我正在 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]

[ArangoError3103: failed to invoke module File: c:/Program Files/ArangoDB2.6.2/var/lib/arangodb-apps/_db/_system/exameFacil/APP/controllers/clinics.js]at [object Object].Module.run (C:\Program Files\ArangoDB2.6.2\bin../share/arangodb/js/common/bootstrap/modules.js:1420:20)   at ArangoApp.loadAppScript (c:/Program Files/ArangoDB2.6.2/share/arangodb/js/server/modules/org/arangodb/foxx/arangoApp.js:452:24)at mountController (c:/Program Files/ArangoDB2.6.2/share/arangodb/js/server/modules/org/arangodb/foxx/routing.js:661:7)at c:/Program Files/ArangoDB2.6.2/share/arangodb/js/server/modules/org/arangodb/foxx/routing.js:630:9at Array.forEach (native)   at routeApp (c:/Program Files/ArangoDB2.6.2/share/arangodb/js/server/modules/org/arangodb/foxx/routing.js:629:32)at Object.routes (c:/Program Files/ArangoDB2.6.2/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:268:10)at foxxRouting (c:/Program Files/ArangoDB2.6.2/share/arangodb/js/server/modules/org/arangodb/actions.js:1054:74)at execute (c:/Program Files/ArangoDB2.6.2/share/arangodb/js/server/modules/org/arangodb/actions.js:1308:7)   at Object.routeRequest (c:/Program Files/ArangoDB2.6.2/share/arangodb/js/server/modules/org/arangodb/actions.js:1329:3)   at Function.actions.defineHttp.callback (c:\Program Files\ArangoDB2.6.2\share\arangodb\js\actions\api-system.js:58:15) 

每当我尝试“要求”clinics.js 文件时,都会发生此错误。有什么建议么?谢谢!

最佳答案

你能试试换行吗

exports.repository = ClinicsRepository;

module.exports = ClinicsRepository;

然后错误应该消失了。

除此之外,可能需要更改 AQL 查询中的过滤器

FILTER clinic._key == [@id]

FILTER clinic._key == @id

FILTER clinic._key IN @id

实际查找文档,具体取决于您是要查找单个文档还是文档数组。

关于javascript - ArangoDB/FOXX 存储库问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31714073/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com