1
我试图在neo4j中创建一个独特的节点,但无法使其工作。neo4j rest api独特性不起作用?
节点代码:
var node = db.createNode({sampleDataKey: "sampleDataValue"});
node.save(function (err, user) {
node.index('user', 'indexValue', 'indexValue', function (err) {
if (err) console.log(err);
console.log(user.id);
});
});
我使用这个节点模块:https://github.com/thingdom/node-neo4j
我从Neo4j的LIB修改Node.js的。到:
else {
var urlToPost = ((("" + services.node_index) + "/") + index + '?uniqueness=create_or_fail');
console.log(urlToPost);
console.log(key + ':' + value);
/* 123 */ return __this._request.post({
/* 124 */ url: urlToPost,
/* 125 */ json: {
/* 126 */ key: key,
/* 127 */ value: value,
/* 128 */ uri: __this.self
}
}, __cb(_, __frame, 17, 21, function ___(__0, __4) {
/* 123 */ response = __4;
console.log('response');
__then();
}, true));
}
每次我执行代码创建一个新的新节点,但在那之后错误。 ... 这里是控制台日志2个处决:“独特性= create_or_fail”
30 May 16:51:24 - [nodemon] starting `node app.js`
Express server listening on port 3000
http://localhost:7474/db/data/index/node/user?uniqueness=create_or_fail
indexValue:indexValue
response
338
30 May 16:55:38 - [nodemon] restarting due to changes...
30 May 16:55:38 - [nodemon] /Users/nikolaialeksandrenko/Documents/work/noject/app.js
30 May 16:55:38 - [nodemon] starting `node app.js`
Express server listening on port 3000
http://localhost:7474/db/data/index/node/user?uniqueness=create_or_fail
indexValue:indexValue
response
339
嗨Aleksandrenko你的意思是它的作品第一次,但不是第二次或以后? – tgkprog
是的。第一次作品正确,之后它不... – Aleksandrenko
好吧我不确定只是试图澄清。当你说它第一次工作时 - >你能看到数据库中的对象键 - >它是随机还是相同的样本值? – tgkprog