我使用下面的neo4j代码从neo4j数据库获取节点和链接

时间:2017-01-20 19:30:07

标签: neo4j

我使用neo4j下面的代码从neo4j数据库获取节点和链接。

from django.contrib.admin import AdminSite

class MyAdmin(AdminSite):
    def app_index(self, request, app_label, extra_context=None):
        if not extra_context:
            extra_context = {}
        extra_context['my_new_key'] = 'val'

        super().app_index(request, app_label, extra_context=extra_context)

但我得到的错误。有人在这里帮助我

module.exports = function (resultcall){
  let neo4j = require('neo4j-driver').v1;
  let driver = neo4j.driver("bolt://192.168.1.113", neo4j.auth.basic("neo4j", "neo4js"));


  let query = `:POST /db/data{"statements":[{"statement":"MATCH path = (n)-[r]->(m)
  RETURN path","resultDataContents":["graph","row"]}]}`;
  let session = driver.session();
  session
      .run(query)
      .then(function(result) {
          console.log(result);
          // Completed!
          session.close();
          resultcall(result);
      })
      .catch(function(error) {
          console.log(error);
      });
}

1 个答案:

答案 0 :(得分:0)

run()应该作为第一个参数传递Cypher语句,并且可选地将参数作为第二个参数传递。例如:

let query = "MATCH path = (n)-[r]->(m) RETURN path";
...
.run(query)
...