- This is server-side only package, to retrieve data from the client use call(s) and methods
- This package uses batch operations to perform queries, than means if you sending multiple queries to Neo4j in current event loop, all of them will be sent in closest (next) event loop inside of the one batch
- This package was tested and works like a charm with GrapheneDB
- Please see demo hosted on Meteor (GrapheneDB) and on Heroku (GrapheneDB Add-on)
- To find more about how to use Cypher read Neo4j cheat sheet
See also Isomorphic Reactive Driver.
meteor add ostrio:neo4jdriver
Error: Cannot find module 'fibers'
- install version with-fiber
postfix, like:ostrio:[email protected]
- see Issue #26 and Issue #32 for detailserror: neo4jdriver is not compatible with architecture...
- install version without-fibers
postfix, like:ostrio:[email protected]
- Hosted on Meteor (GrapheneDB) and on Heroku (GrapheneDB Add-on)
- Check out it's source code
Please see full API with examples in neo4j-fiber wiki
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"]
# }
# }
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.
# 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 ./