【发布时间】:2017-12-20 13:21:01
【问题描述】:
我正在使用 Arangodb 和 Node.js。我正在尝试在数据库中使用 edgecollection。我已经从 npm 下载了 arangojs 并尝试了示例代码。
// ## Assigning the values
const arangojs = require('arangojs');
const aqlQuery = arangojs.aqlQuery;
const now = Date.now();
// ## Const variables for connecting to ArangoDB database
const host = '192.100.00.000'
const port = '8529'
const username = 'xyz'
const password = 'XYZ'
const path = '/_db/sgcdm_app/_api/'
const database = 'sgcdm_app'
// ## Connection to ArangoDB
db = new arangojs.Database({
url: http://${host}:${port},
databaseName: database
});
db.useBasicAuth(username, password);
// ## Working with EDGES
const collection = db.edgeCollection('included_in');
const edge = collection.edge('included_in/595783');
const assert = require('assert');
// the edge exists
assert.equal(edge._key, '595783');
assert.equal(edge._id, 'included_in/595783');
console.log(db);
错误:
assert.js:42 throw new errors.AssertionError({ AssertionError [ERR_ASSERTION]: undefined == '595783'
【问题讨论】:
-
是什么让你认为未定义的边实际上在
included_in集合中?