@@ -37,7 +37,7 @@ describe('examples', function() {
3737 jasmine . DEFAULT_TIMEOUT_INTERVAL = 10000 ;
3838
3939 //tag::construct-driver[]
40- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
40+ var driver = neo4j . driver ( "bolt://localhost:7687 " , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
4141 //end::construct-driver[]
4242 driverGlobal = driver ;
4343 } ) ;
@@ -68,13 +68,14 @@ describe('examples', function() {
6868 var neo4j = require ( 'neo4j-driver' ) . v1 ;
6969 // end::minimal-example-import[]
7070 // tag::minimal-example[]
71- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
71+ var driver = neo4j . driver ( "bolt://localhost:7687 " , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
7272 var session = driver . session ( ) ;
7373 session
74- . run ( "CREATE (a:Person {name:'Arthur' , title:'King'})" )
74+ . run ( "CREATE (a:Person {name: {name} , title: {title}})" , { name : "Arthur" , title : "King" } )
7575 . then ( function ( )
7676 {
77- return session . run ( "MATCH (a:Person) WHERE a.name = 'Arthur' RETURN a.name AS name, a.title AS title" )
77+ return session . run ( "MATCH (a:Person) WHERE a.name = {name} RETURN a.name AS name, a.title AS title" ,
78+ { name : "Arthur" } )
7879 } )
7980 . then ( function ( result ) {
8081 console . log ( result . records [ 0 ] . get ( "title" ) + " " + result . records [ 0 ] . get ( "name" ) ) ;
@@ -91,11 +92,11 @@ describe('examples', function() {
9192 it ( 'should be able to configure session pool size' , function ( done ) {
9293 var neo4j = neo4jv1 ;
9394 // tag::configuration[]
94- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) , { connectionPoolSize : 50 } ) ;
95+ var driver = neo4j . driver ( "bolt://localhost:7687 " , neo4j . auth . basic ( "neo4j" , "neo4j" ) , { connectionPoolSize : 50 } ) ;
9596 //end::configuration[]
9697
9798 var s = driver . session ( ) ;
98- s . run ( "CREATE (p:Person { name: {name} })" , { name : "The One" } )
99+ s . run ( "CREATE (p:Person {name: {name}})" , { name : "The One" } )
99100 . then ( function ( result ) {
100101 var theOnesCreated = result . summary . counters . nodesCreated ( ) ;
101102 console . log ( theOnesCreated ) ;
@@ -129,7 +130,7 @@ describe('examples', function() {
129130 var session = driverGlobal . session ( ) ;
130131 // tag::statement-without-parameters[]
131132 session
132- . run ( "CREATE (p:Person { name: 'Arthur' })" )
133+ . run ( "CREATE (p:Person {name: 'Arthur'})" )
133134 // end::statement-without-parameters[]
134135 . then ( function ( result ) {
135136 var theOnesCreated = result . summary . counters . nodesCreated ( ) ;
@@ -147,12 +148,12 @@ describe('examples', function() {
147148 it ( 'should be able to iterate results' , function ( done ) {
148149 var session = driverGlobal . session ( ) ;
149150 session
150- . run ( "CREATE (weapon:Weapon { name: ' Sword in the stone' })" )
151+ . run ( "CREATE (weapon:Weapon {name: { name}})" , { name : " Sword in the stone" } )
151152 . then ( function ( ) {
152153 // tag::result-traversal[]
153154 var searchTerm = "Sword" ;
154155 session
155- . run ( "MATCH (weapon:Weapon) WHERE weapon.name CONTAINS {term} RETURN weapon.name" , { term : searchTerm } )
156+ . run ( "MATCH (weapon:Weapon) WHERE weapon.name CONTAINS {term} RETURN weapon.name" , { term : searchTerm } )
156157 . subscribe ( {
157158 onNext : function ( record ) {
158159 console . log ( "" + record . get ( "weapon.name" ) ) ;
@@ -176,12 +177,14 @@ describe('examples', function() {
176177 it ( 'should be able to access records' , function ( done ) {
177178 var session = driverGlobal . session ( ) ;
178179 session
179- . run ( "CREATE (weapon:Weapon { name: 'Sword in the stone', owner: 'Arthur', material: 'Stone', size: 'Huge' })" )
180+ . run ( "CREATE (weapon:Weapon {name: {name}, owner: {owner}, material: {material}, size: {size}})" ,
181+ { name : "Sword in the stone" , owner : "Arthur" , material : "Stone" , size : "Huge" } )
180182 . then ( function ( ) {
181183 // tag::access-record[]
182184 var searchTerm = "Arthur" ;
183185 session
184- . run ( "MATCH (weapon:Weapon) WHERE weapon.owner CONTAINS {term} RETURN weapon.name, weapon.material, weapon.size" , { term : searchTerm } )
186+ . run ( "MATCH (weapon:Weapon) WHERE weapon.owner CONTAINS {term} RETURN weapon.name, weapon.material, weapon.size" ,
187+ { term : searchTerm } )
185188 . subscribe ( {
186189 onNext : function ( record ) {
187190 var sword = [ ] ;
@@ -212,11 +215,12 @@ describe('examples', function() {
212215 var session = driverGlobal . session ( ) ;
213216
214217 session
215- . run ( "CREATE (knight:Person:Knight { name: ' Lancelot' , castle: ' Camelot' })" )
218+ . run ( "CREATE (knight:Person:Knight {name: { name}, castle: {castle}})" , { name : " Lancelot" , castle : " Camelot" } )
216219 . then ( function ( ) {
217220 // tag::retain-result[]
218221 session
219- . run ( "MATCH (knight:Person:Knight) WHERE knight.castle = {castle} RETURN knight.name AS name" , { castle : "Camelot" } )
222+ . run ( "MATCH (knight:Person:Knight) WHERE knight.castle = {castle} RETURN knight.name AS name" ,
223+ { castle : "Camelot" } )
220224 . then ( function ( result ) {
221225 var records = [ ] ;
222226 for ( var i = 0 ; i < result . records . length ; i ++ ) {
@@ -244,17 +248,19 @@ describe('examples', function() {
244248 it ( 'should be able to do nested queries' , function ( done ) {
245249 var session = driverGlobal . session ( ) ; ;
246250 session
247- . run ( "CREATE (knight:Person:Knight { name: 'Lancelot', castle: 'Camelot' })" +
248- "CREATE (king:Person { name: 'Arthur', title: 'King' })" )
251+ . run ( "CREATE (knight:Person:Knight {name: {name1}, castle: {castle}})" +
252+ "CREATE (king:Person {name: {name2}, title: {title}})" ,
253+ { name1 : "Lancelot" , castle : "Camelot" , name2 : "Arthur" , title : "King" } )
249254 . then ( function ( ) {
250255 // tag::nested-statements[]
251256 session
252- . run ( "MATCH (knight:Person:Knight) WHERE knight.castle = {castle} RETURN id(knight) AS knight_id" , { "castle" : "Camelot" } )
257+ . run ( "MATCH (knight:Person:Knight) WHERE knight.castle = {castle} RETURN id(knight) AS knight_id" ,
258+ { castle : "Camelot" } )
253259 . subscribe ( {
254260 onNext : function ( record ) {
255261 session
256262 . run ( "MATCH (knight) WHERE id(knight) = {id} MATCH (king:Person) WHERE king.name = {king} CREATE (knight)-[:DEFENDS]->(king)" ,
257- { "id" : record . get ( "knight_id" ) , " king" : "Arthur" } ) ;
263+ { id : record . get ( "knight_id" ) , king : "Arthur" } ) ;
258264 } ,
259265 onCompleted : function ( ) {
260266 session
@@ -295,7 +301,7 @@ describe('examples', function() {
295301 it ( 'should be able to profile' , function ( done ) {
296302 var session = driverGlobal . session ( ) ;
297303
298- session . run ( "CREATE (:Person {name:'Arthur'})" ) . then ( function ( ) {
304+ session . run ( "CREATE (:Person {name: {name}})" , { name : "Arthur" } ) . then ( function ( ) {
299305 // tag::result-summary-query-profile[]
300306 session
301307 . run ( "PROFILE MATCH (p:Person {name: {name}}) RETURN id(p)" , { name : "Arthur" } )
@@ -340,7 +346,7 @@ describe('examples', function() {
340346
341347 // tag::transaction-commit[]
342348 var tx = session . beginTransaction ( ) ;
343- tx . run ( "CREATE (:Person {name: 'Guinevere'})" ) ;
349+ tx . run ( "CREATE (:Person {name: {name}})" , { name : "Guinevere" } ) ;
344350 tx . commit ( ) . then ( function ( ) { session . close ( ) } ) ;
345351 // end::transaction-commit[]
346352 } ) ;
@@ -350,15 +356,15 @@ describe('examples', function() {
350356
351357 // tag::transaction-rollback[]
352358 var tx = session . beginTransaction ( ) ;
353- tx . run ( "CREATE (:Person {name: 'Merlin'})" ) ;
359+ tx . run ( "CREATE (:Person {name: {name}})" , { name : "Merlin" } ) ;
354360 tx . rollback ( ) . then ( function ( ) { session . close ( ) } ) ;
355361 // end::transaction-rollback[]
356362 } ) ;
357363
358364 it ( 'should document how to require encryption' , function ( ) {
359365 var neo4j = neo4jv1 ;
360366 // tag::tls-require-encryption[]
361- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) , {
367+ var driver = neo4j . driver ( "bolt://localhost:7687 " , neo4j . auth . basic ( "neo4j" , "neo4j" ) , {
362368 //In NodeJS, encryption is ENCRYPTION_NON_LOCAL on by default. In the web bundle, it is ENCRYPTION_OFF.
363369 encrypted :"ENCRYPTION_ON"
364370 } ) ;
@@ -369,7 +375,7 @@ describe('examples', function() {
369375 it ( 'should document how to configure trust-on-first-use' , function ( ) {
370376 var neo4j = neo4jv1 ;
371377 // tag::tls-trust-on-first-use[]
372- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) , {
378+ var driver = neo4j . driver ( "bolt://localhost:7687 " , neo4j . auth . basic ( "neo4j" , "neo4j" ) , {
373379 // Note that trust-on-first-use is not available in the browser bundle,
374380 // in NodeJS, trust-on-first-use is the default trust mode. In the browser
375381 // it is TRUST_CUSTOM_CA_SIGNED_CERTIFICATES.
@@ -383,7 +389,7 @@ describe('examples', function() {
383389 it ( 'should document how to configure a trusted signing certificate' , function ( ) {
384390 var neo4j = neo4jv1 ;
385391 // tag::tls-signed[]
386- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) , {
392+ var driver = neo4j . driver ( "bolt://localhost:7687 " , neo4j . auth . basic ( "neo4j" , "neo4j" ) , {
387393 trust : "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES" ,
388394 // Configuring which certificates to trust here is only available
389395 // in NodeJS. In the browser bundle the browsers list of trusted
@@ -398,7 +404,7 @@ describe('examples', function() {
398404 it ( 'should document how to disable auth' , function ( ) {
399405 var neo4j = neo4jv1 ;
400406 // tag::connect-with-auth-disabled[]
401- var driver = neo4j . driver ( "bolt://localhost" , {
407+ var driver = neo4j . driver ( "bolt://localhost:7687 " , {
402408 // In NodeJS, encryption is on by default. In the web bundle, it is off.
403409 encrypted :"ENCRYPTION_NON_LOCAL"
404410 } ) ;
0 commit comments