简体   繁体   中英

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.

The manual shows require("@arangodb").db._name(); which works fine from arangosh but when I try to require('@arangodb') in the app, node throws

Error: Cannot find module '@arangodb'.

Attempting to install from NPM results in an error that it is not in the NPM registry.

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.

The @arangodb module can not be required in Node.js. It works in ArangoDB's V8 environment only. It is available in arangosh, Foxx, JS transactions and user-defined AQL functions.

If you want to talk to ArangoDB from a JavaScript environment like Node.js or a browser, then use the official JavaScript driver arangojs . Note that its interface is different from the one provided by the @arangodb module .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM