dekomote:neo4jdriver

Windows Build. Original package: ostrio:neo4jdriver


Keywords
driver, graphenedb, meteor, meteor-package, neo4j-database, neo4j-driver
License
BSD-3-Clause
Install
meteor add dekomote:neo4jdriver@=0.2.15

Documentation

Join the chat at https://gitter.im/VeliovGroup/ostrio-neo4jdriver

Neo4j Driver

See also Isomorphic Reactive Driver.

Install to meteor

meteor add ostrio:neo4jdriver

Known issues

  • Error: Cannot find module 'fibers' - install version with -fiber postfix, like: ostrio:neo4jdriver@1.0.2-fiber - see Issue #26 and Issue #32 for details
  • error: neo4jdriver is not compatible with architecture... - install version without -fibers postfix, like: ostrio:neo4jdriver@1.0.2

Demo Apps

API

Please see full API with examples in neo4j-fiber wiki

Basic Usage

db = new Neo4jDB 'http://localhost:7474', {
    username: 'neo4j'
    password: '1234'
  }

cursor = db.query 'CREATE (n:City {props}) RETURN n', 
  props: 
    title: 'Ottawa'
    lat: 45.416667
    long: -75.683333

console.log cursor.fetch()
# Returns array of nodes:
# [{
#   n: {
#     long: -75.683333,
#     lat: 45.416667,
#     title: "Ottawa",
#     id: 8421,
#     labels": ["City"],
#     metadata: {
#       id: 8421,
#       labels": ["City"]
#     }
#   }
# }]

# Iterate through results as plain objects:
cursor.forEach (node) ->
  console.log node
  # Returns node as Object:
  # {
  #   n: {
  #     long: -75.683333,
  #     lat: 45.416667,
  #     title: "Ottawa",
  #     id: 8421,
  #     labels": ["City"],
  #     metadata: {
  #       id: 8421,
  #       labels": ["City"]
  #     }
  #   }
  # }

# Iterate through cursor as `Neo4jNode` instances:
cursor.each (node) ->
  console.log node.n.get()
  # {
  #   long: -75.683333,
  #   lat: 45.416667,
  #   title: "Ottawa",
  #   id: 8421,
  #   labels": ["City"],
  #   metadata: {
  #     id: 8421,
  #     labels": ["City"]
  #   }
  # }

Testing & Dev usage

Local usage

To use the ostrio-neo4jdriver in a project and benefit from updates to the driver as they are released, you can keep your project and the driver in separate directories, and create a symlink between them.

# Stop meteor if it is running
$ cd /directory/of/your/project
# If you don't have a Meteor project yet, create a new one:
$ meteor create MyProject
$ cd MyProject
# Create `packages` directory inside project's dir
$ mkdir packages
$ cd packages
# Clone this repository to a local `packages` directory
$ git clone --bare https://github.com/VeliovGroup/ostrio-neo4jdriver.git
# If you need dev branch, switch into it
$ git checkout dev
# Go back into project's directory
$ cd ../
$ meteor add ostrio:neo4jdriver
# Do not forget to run Neo4j database, before start work with package

From now any changes in ostrio:neo4jdriver package folder will cause your project app to rebuild.

To run tests:
# Go to local package folder
$ cd packages/ostrio-neo4jdriver
# Edit first line of `tests.coffee` to set connection to your Neo4j database
# Do not forget to run Neo4j database
$ meteor test-packages ./