[英]ArangoDB How can I use methods in the @arangodb namespace in a Node/Express app?
I am trying to use the database methods like db._databases()
or db._name()
in a node app. 我正在尝试在节点应用程序中使用db._databases()
或db._name()
类的数据库方法。
The manual shows require("@arangodb").db._name();
该手册显示了require("@arangodb").db._name();
which works fine from arangosh but when I try to require('@arangodb')
in the app, node throws 从arangosh可以正常工作,但是当我尝试在应用程序中require('@arangodb')
时,节点抛出
Error: Cannot find module '@arangodb'. 错误:找不到模块“ @arangodb”。
Attempting to install from NPM results in an error that it is not in the NPM registry. 尝试从NPM安装会导致错误,提示它不在NPM注册表中。
So how can one require that namespace? 那么,如何才能要求该名称空间呢? Any pointers in the right direction would be greatly appreciated. 朝正确方向的任何指针将不胜感激。
PS: I'm running the current 3.4rc in a docker container in case this makes a difference. PS:我正在docker容器中运行当前的3.4rc,以防万一。
The @arangodb
module can not be required in Node.js. Node.js中不需要@arangodb
模块。 It works in ArangoDB's V8 environment only. 它仅在ArangoDB的V8环境中工作。 It is available in arangosh, Foxx, JS transactions and user-defined AQL functions. 它在arangosh,Foxx,JS事务和用户定义的AQL函数中可用。
If you want to talk to ArangoDB from a JavaScript environment like Node.js or a browser, then use the official JavaScript driver arangojs . 如果要从Node.js之类的JavaScript环境或浏览器与ArangoDB进行通信,请使用官方JavaScript驱动程序arangojs 。 Note that its interface is different from the one provided by the @arangodb
module . 请注意,其接口与@arangodb
模块提供的接口不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.