尝试从arangodb检索数据时出现此错误。
TypeError:db.database不是函数
var Database = require('arangojs');
var db = new Database({url:'http://127.0.0.1:8529'});
module.exports = {
getAllUsers : function()
{
return db.database('superrango')
.then(function (mydb) {return mydb.query('FOR x IN Users RETURN x');})
.then(function (cursor) { return cursor.all();});
}
}
答案 0 :(得分:0)
最后破解了它
var arangojs = require("arangojs");
var db = new arangojs.Database('http://127.0.0.1:8529');
db.useDatabase("superrango");
db.useBasicAuth("root", "asdf");
module.exports = {
getAllUsers : function()
{
return db.query('FOR x IN Users RETURN x')
.then((value) => {return value.all();});
}
}