{"__v":1,"_id":"57d6af1246dcc30e007dd15f","category":{"__v":0,"_id":"57d6ada046dcc30e007dd15e","project":"566c97797831040d003eb3bc","version":"566c97797831040d003eb3bf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-09-12T13:29:04.136Z","from_sync":false,"order":8,"slug":"drivers-and-languages","title":"Language center"},"parentDoc":null,"project":"566c97797831040d003eb3bc","user":"5716283e40ef9c2000cac92a","version":{"__v":10,"_id":"566c97797831040d003eb3bf","project":"566c97797831040d003eb3bc","createdAt":"2015-12-12T21:54:01.970Z","releaseDate":"2015-12-12T21:54:01.970Z","categories":["566c977a7831040d003eb3c0","5716338cb5af590e00a0ff1d","57163947893cbe0e002d75fc","57163f41b5af590e00a0ff35","57cd74d2873de50e00724a2f","57cd7de8baaee30e0093ecc3","57d6ada046dcc30e007dd15e","57fdc2b31646dc0e0010480a","57fdd8b86c9d141900d87bf1","58767da4d89ef20f003b6f1e"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-12T13:35:14.252Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"If Javascript is your language of choice, the most popular drivers for Neo4j are:\n\n* [Neo4j Javascript driver](#section-neo4j-bolt-driver-for-javascript) [official driver]\n* [Node-Neo4j](#section-node-neo4j) [community driver]\n* [Seraph](#section-seraph) [community driver]\n* [Neo4j-fiber](#section-neo4j-fiber) [community driver]\n* [Meteor: Neo4jdriver](#section-meteor-neo4jdriver) [community driver]\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"About connection parameters\",\n  \"body\": \"We've used test credentials for all the following examples. Please replace them with your real connection parameters.\\n\\nYou'll find all the required information to connect to your database on our admin panel if you navigate to the Connection section. More on connecting to your database [here](doc:connecting-to-your-database)\"\n}\n[/block]\n## Neo4j Bolt driver for Javascript\n\nThe Neo4j Bolt driver for Javascript is officially supported by Neo4j and connects to the database using the new binary Bolt protocol (HTTP/HTTPS is not available).\n\nDriver web page: http://neo4j.com/docs/api/javascript-driver/current/\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"**Bolt protocol is only available in 3.0.0 or higher versions of Neo4j.** You can check your Neo4j version if you navigate to the Overview page of your database.\"\n}\n[/block]\nInstall neo4j-driver via npm:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ npm install neo4j-driver\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nConnect to the Neo4j instance:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var neo4j = require('neo4j-driver').v1;\\n\\nvar driver = neo4j.driver(\\\"bolt://hobby-geefdaeefcom.dbs.graphenedb.com:24786\\\", neo4j.auth.basic(\\\"v303\\\", \\\"GtGq5rldxu\\\"));\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nYou can test the connection by creating a dummy node:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var session = driver.session();\\nsession\\n    .run(\\\"CREATE (n:Person {name:'Bob'}) RETURN n.name\\\")\\n    .then(function(result) {\\n        result.records.forEach(function(record) {\\n            console.log(record)\\n        });\\n\\n        session.close();\\n    })\\n    .catch(function(error) {\\n        console.log(error);\\n    });\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n## node-neo4j\n\nnode-neo4j is a Neo4j community driver maintained by the developers at FiftyThree, the makers of the popular iOS app, Paper. \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"This driver only supports REST endpoints.\",\n  \"title\": \"Please note:\"\n}\n[/block]\nThere are two versions of this package available. Please read on to select the right version of the package for your database.\n\n**node-neo4j v1**\n\nIf your database is on Neo4j 1.x, you'll need to use node-neo4j v1. This version only supports Neo4j 1.5 through 2.1. You can read more about this driver version here: https://github.com/thingdom/node-neo4j/tree/v1\n\n**node-neo4j v2**\n\nnode-neo4j v2 is the latest version (still in Release Candidate status at the time of writing this guide). The following instructions and examples are for node-neo4j v2. \n\nDriver v2 documentation page: https://github.com/thingdom/node-neo4j/tree/v2\n\nInstall node-neo4j via npm:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ npm install neo4j --save\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nConnect to the Neo4j instance using the GrapheneDB connection settings:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var neo4j = require('neo4j');\\nvar db = new neo4j.GraphDatabase(\\\"http://v303:GtGq5rldxu:::at:::hobby-geefdaeefcom.dbs.graphenedb.com:24789\\\");\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nTest the connection by creating a dummy node:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"db.cypher({\\n    query: 'CREATE (n:Person {name: {personName}}) RETURN n',\\n    params: {\\n        personName: 'Bob'\\n    }\\n}, function(err, results){\\n    var result = results[0];\\n    if (err) {\\n        console.error('Error saving new node to database:', err);\\n    } else {\\n        console.log('Node saved to database with id:', result['n']['_id']);\\n    }\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n## Seraph\n\nSeraph is a Neo4j community driver. This driver is a thin and familiar layer between node and neo4j's REST API.\n\nThe authors are working on supporting Bolt, but for now there is no stable release that provides support for the new binary protocol.\n\nDriver documentation page: https://github.com/brikteknologier/seraph\n\nInstall seraph via npm:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ npm install seraph\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nSetting up the HTTP or HTTPS connection:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var db = require(\\\"seraph\\\")({\\n  server: \\\"http://hobby-geefdaeefcom.dbs.graphenedb.com:24789\\\",\\n  user: \\\"v303\\\",\\n  pass: \\\"GtGq5rldxu\\\"\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nTest the connection by creating and deleting a dummy node:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var cypherQuery = \\\"CREATE (n:Person {name: {personName}}) RETURN n\\\";\\ndb.query(cypherQuery, {name: \\\"Bob\\\"}, function(err, results) {\\n  var result = results[0];\\n  if (err) {\\n      console.error('Error saving new node to database:', err);\\n  } else {\\n      console.log('Node saved to database with id:', result.id);\\n  }\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n## Neo4j-fiber\n\nNeo4j-fiber is a Neo4j community driver. This driver heavily depends on [Fibers](https://www.npmjs.com/package/fibers), so you’re required to wrap all code into Fiber.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Please note\",\n  \"body\": \"Bolt protocol was not supported by this driver.\"\n}\n[/block]\nDriver documentation page: https://www.npmjs.com/package/neo4j-fiber\nDemo application: https://github.com/VeliovGroup/neo4j-demo\n\nInstall neo4j-fiber via npm:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"npm install --save neo4j-fiber\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nSetting up the HTTP or HTTPS connection:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var Fiber = require('fibers');\\nvar Neo4jDB = requre('neo4j-fiber').Neo4jDB;\\n\\nFiber(function(){\\n  const db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');\\n}).run();\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nTest the connection by creating a dummy node:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var node = db.nodes({name: 'Bob'}).label(['Person']);\\n\\nconsole.log(node.get());\\n// {\\n//   n: {\\n//     name: \\\"Bob\\\",\\n//     id: 1\\n//   }\\n// }\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n### Meteor.js\n\nNeo4j-fiber is fully compatible with Meteor.js. You can install [neo4j-fiber](#section-neo4j-fiber) via npm:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"meteor npm install --save neo4j-fiber\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nSetting up the HTTP or HTTPS connection:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var Neo4jDB = require('neo4j-fiber').Neo4jDB;\\n\\nvar db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n## Meteor: Neo4jdriver\n\nNeo4jdriver is a Neo4j community driver. This driver is designed to be used on the server side of a Meteor application.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Please note\",\n  \"body\": \"This driver will be deprecated soon in favour of npm package. The driver's author recommends to use [neo4j-fiber](#section-meteor-js), as it's fully compatible with Meteor.\"\n}\n[/block]\nDriver documentation page: https://atmospherejs.com/ostrio/neo4jdriver\n\nInstall neo4jdriver to Meteor:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"meteor add ostrio:neo4jdriver\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nSetting up the HTTP or HTTPS connection:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import { Neo4jDB } from 'meteor/ostrio:neo4jdriver';\\n\\nconst db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nSee the [Neo4j-fiber section](#section-neo4j-fiber) to find an example.","excerpt":"","slug":"nodejs","type":"basic","title":"Node.js"}
If Javascript is your language of choice, the most popular drivers for Neo4j are: * [Neo4j Javascript driver](#section-neo4j-bolt-driver-for-javascript) [official driver] * [Node-Neo4j](#section-node-neo4j) [community driver] * [Seraph](#section-seraph) [community driver] * [Neo4j-fiber](#section-neo4j-fiber) [community driver] * [Meteor: Neo4jdriver](#section-meteor-neo4jdriver) [community driver] [block:callout] { "type": "info", "title": "About connection parameters", "body": "We've used test credentials for all the following examples. Please replace them with your real connection parameters.\n\nYou'll find all the required information to connect to your database on our admin panel if you navigate to the Connection section. More on connecting to your database [here](doc:connecting-to-your-database)" } [/block] ## Neo4j Bolt driver for Javascript The Neo4j Bolt driver for Javascript is officially supported by Neo4j and connects to the database using the new binary Bolt protocol (HTTP/HTTPS is not available). Driver web page: http://neo4j.com/docs/api/javascript-driver/current/ [block:callout] { "type": "warning", "body": "**Bolt protocol is only available in 3.0.0 or higher versions of Neo4j.** You can check your Neo4j version if you navigate to the Overview page of your database." } [/block] Install neo4j-driver via npm: [block:code] { "codes": [ { "code": "$ npm install neo4j-driver", "language": "shell" } ] } [/block] Connect to the Neo4j instance: [block:code] { "codes": [ { "code": "var neo4j = require('neo4j-driver').v1;\n\nvar driver = neo4j.driver(\"bolt://hobby-geefdaeefcom.dbs.graphenedb.com:24786\", neo4j.auth.basic(\"v303\", \"GtGq5rldxu\"));", "language": "javascript" } ] } [/block] You can test the connection by creating a dummy node: [block:code] { "codes": [ { "code": "var session = driver.session();\nsession\n .run(\"CREATE (n:Person {name:'Bob'}) RETURN n.name\")\n .then(function(result) {\n result.records.forEach(function(record) {\n console.log(record)\n });\n\n session.close();\n })\n .catch(function(error) {\n console.log(error);\n });", "language": "javascript" } ] } [/block] ## node-neo4j node-neo4j is a Neo4j community driver maintained by the developers at FiftyThree, the makers of the popular iOS app, Paper. [block:callout] { "type": "info", "body": "This driver only supports REST endpoints.", "title": "Please note:" } [/block] There are two versions of this package available. Please read on to select the right version of the package for your database. **node-neo4j v1** If your database is on Neo4j 1.x, you'll need to use node-neo4j v1. This version only supports Neo4j 1.5 through 2.1. You can read more about this driver version here: https://github.com/thingdom/node-neo4j/tree/v1 **node-neo4j v2** node-neo4j v2 is the latest version (still in Release Candidate status at the time of writing this guide). The following instructions and examples are for node-neo4j v2. Driver v2 documentation page: https://github.com/thingdom/node-neo4j/tree/v2 Install node-neo4j via npm: [block:code] { "codes": [ { "code": "$ npm install neo4j --save", "language": "shell" } ] } [/block] Connect to the Neo4j instance using the GrapheneDB connection settings: [block:code] { "codes": [ { "code": "var neo4j = require('neo4j');\nvar db = new neo4j.GraphDatabase(\"http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789\");", "language": "javascript" } ] } [/block] Test the connection by creating a dummy node: [block:code] { "codes": [ { "code": "db.cypher({\n query: 'CREATE (n:Person {name: {personName}}) RETURN n',\n params: {\n personName: 'Bob'\n }\n}, function(err, results){\n var result = results[0];\n if (err) {\n console.error('Error saving new node to database:', err);\n } else {\n console.log('Node saved to database with id:', result['n']['_id']);\n }\n});", "language": "javascript" } ] } [/block] ## Seraph Seraph is a Neo4j community driver. This driver is a thin and familiar layer between node and neo4j's REST API. The authors are working on supporting Bolt, but for now there is no stable release that provides support for the new binary protocol. Driver documentation page: https://github.com/brikteknologier/seraph Install seraph via npm: [block:code] { "codes": [ { "code": "$ npm install seraph", "language": "shell" } ] } [/block] Setting up the HTTP or HTTPS connection: [block:code] { "codes": [ { "code": "var db = require(\"seraph\")({\n server: \"http://hobby-geefdaeefcom.dbs.graphenedb.com:24789\",\n user: \"v303\",\n pass: \"GtGq5rldxu\"\n});", "language": "javascript" } ] } [/block] Test the connection by creating and deleting a dummy node: [block:code] { "codes": [ { "code": "var cypherQuery = \"CREATE (n:Person {name: {personName}}) RETURN n\";\ndb.query(cypherQuery, {name: \"Bob\"}, function(err, results) {\n var result = results[0];\n if (err) {\n console.error('Error saving new node to database:', err);\n } else {\n console.log('Node saved to database with id:', result.id);\n }\n});", "language": "javascript" } ] } [/block] ## Neo4j-fiber Neo4j-fiber is a Neo4j community driver. This driver heavily depends on [Fibers](https://www.npmjs.com/package/fibers), so you’re required to wrap all code into Fiber. [block:callout] { "type": "info", "title": "Please note", "body": "Bolt protocol was not supported by this driver." } [/block] Driver documentation page: https://www.npmjs.com/package/neo4j-fiber Demo application: https://github.com/VeliovGroup/neo4j-demo Install neo4j-fiber via npm: [block:code] { "codes": [ { "code": "npm install --save neo4j-fiber", "language": "shell" } ] } [/block] Setting up the HTTP or HTTPS connection: [block:code] { "codes": [ { "code": "var Fiber = require('fibers');\nvar Neo4jDB = requre('neo4j-fiber').Neo4jDB;\n\nFiber(function(){\n const db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');\n}).run();", "language": "javascript" } ] } [/block] Test the connection by creating a dummy node: [block:code] { "codes": [ { "code": "var node = db.nodes({name: 'Bob'}).label(['Person']);\n\nconsole.log(node.get());\n// {\n// n: {\n// name: \"Bob\",\n// id: 1\n// }\n// }", "language": "javascript" } ] } [/block] ### Meteor.js Neo4j-fiber is fully compatible with Meteor.js. You can install [neo4j-fiber](#section-neo4j-fiber) via npm: [block:code] { "codes": [ { "code": "meteor npm install --save neo4j-fiber", "language": "shell" } ] } [/block] Setting up the HTTP or HTTPS connection: [block:code] { "codes": [ { "code": "var Neo4jDB = require('neo4j-fiber').Neo4jDB;\n\nvar db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');", "language": "javascript" } ] } [/block] ## Meteor: Neo4jdriver Neo4jdriver is a Neo4j community driver. This driver is designed to be used on the server side of a Meteor application. [block:callout] { "type": "warning", "title": "Please note", "body": "This driver will be deprecated soon in favour of npm package. The driver's author recommends to use [neo4j-fiber](#section-meteor-js), as it's fully compatible with Meteor." } [/block] Driver documentation page: https://atmospherejs.com/ostrio/neo4jdriver Install neo4jdriver to Meteor: [block:code] { "codes": [ { "code": "meteor add ostrio:neo4jdriver", "language": "shell" } ] } [/block] Setting up the HTTP or HTTPS connection: [block:code] { "codes": [ { "code": "import { Neo4jDB } from 'meteor/ostrio:neo4jdriver';\n\nconst db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');", "language": "javascript" } ] } [/block] See the [Neo4j-fiber section](#section-neo4j-fiber) to find an example.