@@ -62,11 +62,11 @@ describe('examples', function() {
62
62
var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
63
63
var session = driver . session ( ) ;
64
64
session
65
- . run ( "CREATE (a:Person {name: {name}, title: {title}})" , { " name" : "Arthur" , " title" : "King" } )
65
+ . run ( "CREATE (a:Person {name: {name}, title: {title}})" , { name : "Arthur" , title : "King" } )
66
66
. then ( function ( )
67
67
{
68
68
return session . run ( "MATCH (a:Person) WHERE a.name = {name} RETURN a.name AS name, a.title AS title" ,
69
- { " name" : "Arthur" } )
69
+ { name : "Arthur" } )
70
70
} )
71
71
. then ( function ( result ) {
72
72
console . log ( result . records [ 0 ] . get ( "title" ) + " " + result . records [ 0 ] . get ( "name" ) ) ;
@@ -87,7 +87,7 @@ describe('examples', function() {
87
87
//end::configuration[]
88
88
89
89
var s = driver . session ( ) ;
90
- s . run ( "CREATE (p:Person {name: {name}})" , { " name" : "The One" } )
90
+ s . run ( "CREATE (p:Person {name: {name}})" , { name : "The One" } )
91
91
. then ( function ( result ) {
92
92
var theOnesCreated = result . summary . counters . nodesCreated ( ) ;
93
93
console . log ( theOnesCreated ) ;
@@ -104,7 +104,7 @@ describe('examples', function() {
104
104
var session = sessionGlobal ;
105
105
// tag::statement[]
106
106
session
107
- . run ( "CREATE (person:Person {name: {name}})" , { " name" : "Arthur" } )
107
+ . run ( "CREATE (person:Person {name: {name}})" , { name : "Arthur" } )
108
108
// end::statement[]
109
109
. then ( function ( result ) {
110
110
var theOnesCreated = result . summary . counters . nodesCreated ( ) ;
@@ -137,12 +137,12 @@ describe('examples', function() {
137
137
it ( 'should be able to iterate results' , function ( done ) {
138
138
var session = sessionGlobal ;
139
139
session
140
- . run ( "CREATE (weapon:Weapon {name: {name}})" , { " name" : "Sword in the stone" } )
140
+ . run ( "CREATE (weapon:Weapon {name: {name}})" , { name : "Sword in the stone" } )
141
141
. then ( function ( ) {
142
142
// tag::result-traversal[]
143
143
var searchTerm = "Sword" ;
144
144
session
145
- . run ( "MATCH (weapon:Weapon) WHERE weapon.name CONTAINS {term} RETURN weapon.name" , { " term" : searchTerm } )
145
+ . run ( "MATCH (weapon:Weapon) WHERE weapon.name CONTAINS {term} RETURN weapon.name" , { term : searchTerm } )
146
146
. subscribe ( {
147
147
onNext : function ( record ) {
148
148
console . log ( "" + record . get ( "weapon.name" ) ) ;
@@ -167,13 +167,13 @@ describe('examples', function() {
167
167
var session = sessionGlobal ;
168
168
session
169
169
. run ( "CREATE (weapon:Weapon {name: {name}, owner: {owner}, material: {material}, size: {size}})" ,
170
- { " name" : "Sword in the stone" , " owner" : "Arthur" , " material" : "Stone" , " size" : "Huge" } )
170
+ { name : "Sword in the stone" , owner : "Arthur" , material : "Stone" , size : "Huge" } )
171
171
. then ( function ( ) {
172
172
// tag::access-record[]
173
173
var searchTerm = "Arthur" ;
174
174
session
175
175
. run ( "MATCH (weapon:Weapon) WHERE weapon.owner CONTAINS {term} RETURN weapon.name, weapon.material, weapon.size" ,
176
- { " term" : searchTerm } )
176
+ { term : searchTerm } )
177
177
. subscribe ( {
178
178
onNext : function ( record ) {
179
179
var sword = [ ] ;
@@ -204,12 +204,12 @@ describe('examples', function() {
204
204
var session = sessionGlobal ;
205
205
206
206
session
207
- . run ( "CREATE (knight:Person:Knight {name: {name}, castle: {castle}})" , { " name" : "Lancelot" , " castle" : "Camelot" } )
207
+ . run ( "CREATE (knight:Person:Knight {name: {name}, castle: {castle}})" , { name : "Lancelot" , castle : "Camelot" } )
208
208
. then ( function ( ) {
209
209
// tag::retain-result[]
210
210
session
211
211
. run ( "MATCH (knight:Person:Knight) WHERE knight.castle = {castle} RETURN knight.name AS name" ,
212
- { " castle" : "Camelot" } )
212
+ { castle : "Camelot" } )
213
213
. then ( function ( result ) {
214
214
var records = [ ] ;
215
215
for ( i = 0 ; i < result . records . length ; i ++ ) {
@@ -238,17 +238,17 @@ describe('examples', function() {
238
238
session
239
239
. run ( "CREATE (knight:Person:Knight {name: {name1}, castle: {castle}})" +
240
240
"CREATE (king:Person {name: {name2}, title: {title}})" ,
241
- { " name1" : "Lancelot" , " castle" : "Camelot" , " name2" : "Arthur" , " title" : "King" } )
241
+ { name1 : "Lancelot" , castle : "Camelot" , name2 : "Arthur" , title : "King" } )
242
242
. then ( function ( ) {
243
243
// tag::nested-statements[]
244
244
session
245
245
. run ( "MATCH (knight:Person:Knight) WHERE knight.castle = {castle} RETURN id(knight) AS knight_id" ,
246
- { " castle" : "Camelot" } )
246
+ { castle : "Camelot" } )
247
247
. subscribe ( {
248
248
onNext : function ( record ) {
249
249
session
250
250
. run ( "MATCH (knight) WHERE id(knight) = {id} MATCH (king:Person) WHERE king.name = {king} CREATE (knight)-[:DEFENDS]->(king)" ,
251
- { "id" : record . get ( "knight_id" ) , " king" : "Arthur" } ) ;
251
+ { id : record . get ( "knight_id" ) , king : "Arthur" } ) ;
252
252
} ,
253
253
onCompleted : function ( ) {
254
254
session
@@ -287,10 +287,10 @@ describe('examples', function() {
287
287
it ( 'should be able to profile' , function ( done ) {
288
288
var session = sessionGlobal ;
289
289
290
- session . run ( "CREATE (:Person {name: {name}})" , { " name" : "Arthur" } ) . then ( function ( ) {
290
+ session . run ( "CREATE (:Person {name: {name}})" , { name : "Arthur" } ) . then ( function ( ) {
291
291
// tag::result-summary-query-profile[]
292
292
session
293
- . run ( "PROFILE MATCH (p:Person {name: {name}}) RETURN id(p)" , { " name" : "Arthur" } )
293
+ . run ( "PROFILE MATCH (p:Person {name: {name}}) RETURN id(p)" , { name : "Arthur" } )
294
294
. then ( function ( result ) {
295
295
console . log ( result . summary . profile ) ;
296
296
} ) ;
@@ -329,7 +329,7 @@ describe('examples', function() {
329
329
330
330
// tag::transaction-commit[]
331
331
var tx = session . beginTransaction ( ) ;
332
- tx . run ( "CREATE (:Person {name: {name}})" , { " name" : "Guinevere" } ) ;
332
+ tx . run ( "CREATE (:Person {name: {name}})" , { name : "Guinevere" } ) ;
333
333
tx . commit ( ) ;
334
334
// end::transaction-commit[]
335
335
} ) ;
@@ -339,7 +339,7 @@ describe('examples', function() {
339
339
340
340
// tag::transaction-rollback[]
341
341
var tx = session . beginTransaction ( ) ;
342
- tx . run ( "CREATE (:Person {name: {name}})" , { " name" : "Merlin" } ) ;
342
+ tx . run ( "CREATE (:Person {name: {name}})" , { name : "Merlin" } ) ;
343
343
tx . rollback ( ) ;
344
344
// end::transaction-rollback[]
345
345
} ) ;
0 commit comments