@@ -303,7 +303,7 @@ describe('#integration examples', () => {
303
303
// tag::cypher-error[]
304
304
const session = driver . session ( )
305
305
try {
306
- await session . readTransaction ( tx =>
306
+ await session . executeRead ( tx =>
307
307
tx . run ( 'SELECT * FROM Employees WHERE name = $name' , {
308
308
name : personName
309
309
} )
@@ -360,7 +360,7 @@ describe('#integration examples', () => {
360
360
const session = driver . session ( )
361
361
362
362
try {
363
- const result = await session . writeTransaction ( tx =>
363
+ const result = await session . executeWrite ( tx =>
364
364
tx . run (
365
365
'CREATE (a:Greeting) SET a.message = $message RETURN a.message + ", from node " + id(a)' ,
366
366
{ message : 'hello, world' }
@@ -454,7 +454,7 @@ describe('#integration examples', () => {
454
454
RETURN p1, p2, k`
455
455
456
456
// Write transactions allow the driver to handle retries and transient errors
457
- const writeResult = await session . writeTransaction ( tx =>
457
+ const writeResult = await session . executeWrite ( tx =>
458
458
tx . run ( writeQuery , { person1Name, person2Name, knowsFrom } )
459
459
)
460
460
writeResult . records . forEach ( record => {
@@ -469,7 +469,7 @@ describe('#integration examples', () => {
469
469
const readQuery = `MATCH (p:Person)
470
470
WHERE p.name = $personName
471
471
RETURN p.name AS name`
472
- const readResult = await session . readTransaction ( tx =>
472
+ const readResult = await session . executeRead ( tx =>
473
473
tx . run ( readQuery , { personName : person1Name } )
474
474
)
475
475
readResult . records . forEach ( record => {
@@ -500,11 +500,11 @@ describe('#integration examples', () => {
500
500
const session = driver . session ( )
501
501
502
502
try {
503
- await session . writeTransaction ( tx =>
503
+ await session . executeWrite ( tx =>
504
504
tx . run ( 'CREATE (a:Person {name: $name})' , { name : personName } )
505
505
)
506
506
507
- const result = await session . readTransaction ( tx =>
507
+ const result = await session . executeRead ( tx =>
508
508
tx . run ( 'MATCH (a:Person {name: $name}) RETURN id(a)' , {
509
509
name : personName
510
510
} )
@@ -580,12 +580,12 @@ describe('#integration examples', () => {
580
580
// tag::async-multiple-tx[]
581
581
const session = driver . session ( )
582
582
try {
583
- const names = await session . readTransaction ( async tx => {
583
+ const names = await session . executeRead ( async tx => {
584
584
const result = await tx . run ( 'MATCH (a:Person) RETURN a.name AS name' )
585
585
return result . records . map ( record => record . get ( 'name' ) )
586
586
} )
587
587
588
- const relationshipsCreated = await session . writeTransaction ( tx =>
588
+ const relationshipsCreated = await session . executeWrite ( tx =>
589
589
Promise . all (
590
590
names . map ( name =>
591
591
tx
@@ -675,15 +675,15 @@ describe('#integration examples', () => {
675
675
// tag::async-result-retain[]
676
676
const session = driver . session ( )
677
677
try {
678
- const result = await session . readTransaction ( tx =>
678
+ const result = await session . executeRead ( tx =>
679
679
tx . run ( 'MATCH (a:Person) RETURN a.name AS name' )
680
680
)
681
681
682
682
const nameRecords = result . records
683
683
for ( let i = 0 ; i < nameRecords . length ; i ++ ) {
684
684
const name = nameRecords [ i ] . get ( 'name' )
685
685
686
- await session . writeTransaction ( tx =>
686
+ await session . executeWrite ( tx =>
687
687
tx . run (
688
688
'MATCH (emp:Person {name: $person_name}) ' +
689
689
'MERGE (com:Company {name: $company_name}) ' +
@@ -717,7 +717,7 @@ describe('#integration examples', () => {
717
717
} )
718
718
const session = driver . session ( )
719
719
720
- const writeTxPromise = session . writeTransaction ( tx =>
720
+ const writeTxPromise = session . executeWrite ( tx =>
721
721
tx . run ( 'CREATE (a:Item)' )
722
722
)
723
723
@@ -777,7 +777,7 @@ describe('#integration examples', () => {
777
777
const session = driver . session ( )
778
778
const titles = [ ]
779
779
try {
780
- const result = await session . readTransaction ( tx =>
780
+ const result = await session . executeRead ( tx =>
781
781
tx . run ( 'MATCH (p:Product) WHERE p.id = $id RETURN p.title' , { id : 0 } )
782
782
)
783
783
@@ -814,7 +814,7 @@ describe('#integration examples', () => {
814
814
815
815
// tag::rx-transaction-function[]
816
816
const session = driver . rxSession ( )
817
- const result = session . readTransaction ( tx =>
817
+ const result = session . executeRead ( tx =>
818
818
tx
819
819
. run ( 'MATCH (p:Product) WHERE p.id = $id RETURN p.title' , { id : 0 } )
820
820
. records ( )
@@ -848,7 +848,7 @@ describe('#integration examples', () => {
848
848
// tag::transaction-timeout-config[]
849
849
const session = driver . session ( )
850
850
try {
851
- const result = await session . writeTransaction (
851
+ const result = await session . executeWrite (
852
852
tx => addPerson ( tx , personName ) ,
853
853
{ timeout : 10 }
854
854
)
@@ -878,7 +878,7 @@ describe('#integration examples', () => {
878
878
// tag::transaction-metadata-config[]
879
879
const session = driver . session ( )
880
880
try {
881
- const result = await session . writeTransaction (
881
+ const result = await session . executeWrite (
882
882
tx => addPerson ( tx , personName ) ,
883
883
{ metadata : { applicationId : '123' } }
884
884
)
@@ -919,7 +919,7 @@ describe('#integration examples', () => {
919
919
// tag::database-selection[]
920
920
const session = driver . session ( { database : 'examples' } )
921
921
try {
922
- const result = await session . writeTransaction ( tx =>
922
+ const result = await session . executeWrite ( tx =>
923
923
tx . run (
924
924
'CREATE (a:Greeting {message: "Hello, Example-Database"}) RETURN a.message'
925
925
)
@@ -938,7 +938,7 @@ describe('#integration examples', () => {
938
938
defaultAccessMode : neo4j . READ
939
939
} )
940
940
try {
941
- const result = await readSession . writeTransaction ( tx =>
941
+ const result = await readSession . executeWrite ( tx =>
942
942
tx . run ( 'MATCH (a:Greeting) RETURN a.message' )
943
943
)
944
944
@@ -1012,10 +1012,10 @@ describe('#integration examples', () => {
1012
1012
// Create the first person and employment relationship.
1013
1013
const session1 = driver . session ( { defaultAccessMode : neo4j . WRITE } )
1014
1014
const first = session1
1015
- . writeTransaction ( tx => addCompany ( tx , 'Wayne Enterprises' ) )
1016
- . then ( ( ) => session1 . writeTransaction ( tx => addPerson ( tx , 'Alice' ) ) )
1015
+ . executeWrite ( tx => addCompany ( tx , 'Wayne Enterprises' ) )
1016
+ . then ( ( ) => session1 . executeWrite ( tx => addPerson ( tx , 'Alice' ) ) )
1017
1017
. then ( ( ) =>
1018
- session1 . writeTransaction ( tx =>
1018
+ session1 . executeWrite ( tx =>
1019
1019
addEmployee ( tx , 'Alice' , 'Wayne Enterprises' )
1020
1020
)
1021
1021
)
@@ -1027,10 +1027,10 @@ describe('#integration examples', () => {
1027
1027
// Create the second person and employment relationship.
1028
1028
const session2 = driver . session ( { defaultAccessMode : neo4j . WRITE } )
1029
1029
const second = session2
1030
- . writeTransaction ( tx => addCompany ( tx , 'LexCorp' ) )
1031
- . then ( ( ) => session2 . writeTransaction ( tx => addPerson ( tx , 'Bob' ) ) )
1030
+ . executeWrite ( tx => addCompany ( tx , 'LexCorp' ) )
1031
+ . then ( ( ) => session2 . executeWrite ( tx => addPerson ( tx , 'Bob' ) ) )
1032
1032
. then ( ( ) =>
1033
- session2 . writeTransaction ( tx => addEmployee ( tx , 'Bob' , 'LexCorp' ) )
1033
+ session2 . executeWrite ( tx => addEmployee ( tx , 'Bob' , 'LexCorp' ) )
1034
1034
)
1035
1035
. then ( ( ) => {
1036
1036
savedBookmarks . push ( session2 . lastBookmarks ( ) )
@@ -1045,9 +1045,9 @@ describe('#integration examples', () => {
1045
1045
} )
1046
1046
1047
1047
return session3
1048
- . writeTransaction ( tx => makeFriends ( tx , 'Alice' , 'Bob' ) )
1048
+ . executeWrite ( tx => makeFriends ( tx , 'Alice' , 'Bob' ) )
1049
1049
. then ( ( ) =>
1050
- session3 . readTransaction ( findFriendships ) . then ( ( ) => session3 . close ( ) )
1050
+ session3 . executeRead ( findFriendships ) . then ( ( ) => session3 . close ( ) )
1051
1051
)
1052
1052
} )
1053
1053
// end::pass-bookmarks[]
@@ -1506,7 +1506,7 @@ describe('#integration examples', () => {
1506
1506
} )
1507
1507
1508
1508
async function echo ( session , value ) {
1509
- return await session . readTransaction ( async tx => {
1509
+ return await session . executeRead ( async tx => {
1510
1510
const result = await tx . run ( 'RETURN $value as fieldName' , {
1511
1511
value
1512
1512
} )
0 commit comments