[英]Neo4j in Azure mobile services
我一直試圖將Neo4j數據庫用作Azure移動服務中的數據庫。 我正在關注本教程 ,但似乎無法正常工作。 基本上,本教程的工作是:
不幸的是,我的似乎沒有用。 數據已發布到移動服務SQL表,但是要發布到VM上Neo4j服務器的腳本似乎不起作用。 我也知道該VM已正確設置,因為我可以在Neo4j Web管理員頁面中將其連接。
這是腳本的代碼:
function insert(item, user, request) {
//comment to trigger .js creation
var neo4j = require('neo4j');
var db = new neo4j.GraphDatabase('http://<username>:<password>@http://neo4jmobile.cloudapp.net:7474');
var node = db.createNode({ name: item.name });
node.save(function (err, node) {
if (err) {
console.error('Error saving new node to database:', err);
}
else {
console.log('Node saved to database with id:', node.id);
}
});
request.execute();
}
有人對這個有經驗么? 我的腳本有問題嗎? 使用教程的方法? 任何幫助,將不勝感激。
編輯:行有問題: console.err('Error saving new node to database:', err);
必須用console.err('Error saving new node to database:', err);
。 但是我現在收到此錯誤消息:
Error saving new node to database: { [Error: connect ETIMEDOUT]
stack: [Getter/Setter],
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
__frame:
{ name: 'GraphDatabase_prototype__getRoot__1',
line: 76,
file: '\\\\10.211.156.195\\volume-0-default\\bf02c8bd8f7589d46ba1\\4906fa4587734dd087df8e641513f602\\site\\wwwroot\\App_Data\\config\\scripts\\node_modules\\neo4j\\lib\\GraphDatabase.js',
prev:
{ name: 'GraphDatabase_prototype_getServices__2',
line: 99,
file: '\\\\10.211.156.195\\volume-0-default\\bf02c8bd8f7589d46ba1\\4906fa4587734dd087df8e641513f602\\site\\wwwroot\\App_Data\\config\\scripts\\node_modules\\neo4j\\lib\\GraphDatabase.js',
prev: [Object],
active: false,
offset: 5,
col: 12 },
active: false,
offset: 5,
col: 12 },
rawStack: [Getter] }
再一次,任何幫助將不勝感激!
您是否啟用了源代碼控制並npm安裝了neo4j模塊?
米蘭達
好吧,我設法弄清楚了。 問題在於該教程(以及針對node.js的neo4j的文檔)有錯字。 該代碼應該是console.error()
而不是console.err()
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.