- 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.
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
error: neo4jdriver is not compatible with architecture...
- install version without-fibers
postfix, like:ostrio:neo4jdriver@1.0.2
Demo Apps
- Hosted on Meteor (GrapheneDB) and on Heroku (GrapheneDB Add-on)
- Check out it's source code
API
Please see full API with examples in neo4j-fiber wiki
Basic Usage
1db = new Neo4jDB 'http://localhost:7474', { 2 username: 'neo4j' 3 password: '1234' 4 } 5 6cursor = db.query 'CREATE (n:City {props}) RETURN n', 7 props: 8 title: 'Ottawa' 9 lat: 45.416667 10 long: -75.683333 11 12console.log cursor.fetch() 13# Returns array of nodes: 14# [{ 15# n: { 16# long: -75.683333, 17# lat: 45.416667, 18# title: "Ottawa", 19# id: 8421, 20# labels": ["City"], 21# metadata: { 22# id: 8421, 23# labels": ["City"] 24# } 25# } 26# }] 27 28# Iterate through results as plain objects: 29cursor.forEach (node) -> 30 console.log node 31 # Returns node as Object: 32 # { 33 # n: { 34 # long: -75.683333, 35 # lat: 45.416667, 36 # title: "Ottawa", 37 # id: 8421, 38 # labels": ["City"], 39 # metadata: { 40 # id: 8421, 41 # labels": ["City"] 42 # } 43 # } 44 # } 45 46# Iterate through cursor as `Neo4jNode` instances: 47cursor.each (node) -> 48 console.log node.n.get() 49 # { 50 # long: -75.683333, 51 # lat: 45.416667, 52 # title: "Ottawa", 53 # id: 8421, 54 # labels": ["City"], 55 # metadata: { 56 # id: 8421, 57 # labels": ["City"] 58 # } 59 # }
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 ./