@@ -303,7 +303,7 @@ describe('#integration examples', () => {
303303 // tag::cypher-error[]
304304 const session = driver . session ( )
305305 try {
306- await session . readTransaction ( tx =>
306+ await session . executeRead ( tx =>
307307 tx . run ( 'SELECT * FROM Employees WHERE name = $name' , {
308308 name : personName
309309 } )
@@ -360,7 +360,7 @@ describe('#integration examples', () => {
360360 const session = driver . session ( )
361361
362362 try {
363- const result = await session . writeTransaction ( tx =>
363+ const result = await session . executeWrite ( tx =>
364364 tx . run (
365365 'CREATE (a:Greeting) SET a.message = $message RETURN a.message + ", from node " + id(a)' ,
366366 { message : 'hello, world' }
@@ -454,7 +454,7 @@ describe('#integration examples', () => {
454454 RETURN p1, p2, k`
455455
456456 // 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 =>
458458 tx . run ( writeQuery , { person1Name, person2Name, knowsFrom } )
459459 )
460460 writeResult . records . forEach ( record => {
@@ -469,7 +469,7 @@ describe('#integration examples', () => {
469469 const readQuery = `MATCH (p:Person)
470470 WHERE p.name = $personName
471471 RETURN p.name AS name`
472- const readResult = await session . readTransaction ( tx =>
472+ const readResult = await session . executeRead ( tx =>
473473 tx . run ( readQuery , { personName : person1Name } )
474474 )
475475 readResult . records . forEach ( record => {
@@ -500,11 +500,11 @@ describe('#integration examples', () => {
500500 const session = driver . session ( )
501501
502502 try {
503- await session . writeTransaction ( tx =>
503+ await session . executeWrite ( tx =>
504504 tx . run ( 'CREATE (a:Person {name: $name})' , { name : personName } )
505505 )
506506
507- const result = await session . readTransaction ( tx =>
507+ const result = await session . executeRead ( tx =>
508508 tx . run ( 'MATCH (a:Person {name: $name}) RETURN id(a)' , {
509509 name : personName
510510 } )
@@ -580,12 +580,12 @@ describe('#integration examples', () => {
580580 // tag::async-multiple-tx[]
581581 const session = driver . session ( )
582582 try {
583- const names = await session . readTransaction ( async tx => {
583+ const names = await session . executeRead ( async tx => {
584584 const result = await tx . run ( 'MATCH (a:Person) RETURN a.name AS name' )
585585 return result . records . map ( record => record . get ( 'name' ) )
586586 } )
587587
588- const relationshipsCreated = await session . writeTransaction ( tx =>
588+ const relationshipsCreated = await session . executeWrite ( tx =>
589589 Promise . all (
590590 names . map ( name =>
591591 tx
@@ -675,15 +675,15 @@ describe('#integration examples', () => {
675675 // tag::async-result-retain[]
676676 const session = driver . session ( )
677677 try {
678- const result = await session . readTransaction ( tx =>
678+ const result = await session . executeRead ( tx =>
679679 tx . run ( 'MATCH (a:Person) RETURN a.name AS name' )
680680 )
681681
682682 const nameRecords = result . records
683683 for ( let i = 0 ; i < nameRecords . length ; i ++ ) {
684684 const name = nameRecords [ i ] . get ( 'name' )
685685
686- await session . writeTransaction ( tx =>
686+ await session . executeWrite ( tx =>
687687 tx . run (
688688 'MATCH (emp:Person {name: $person_name}) ' +
689689 'MERGE (com:Company {name: $company_name}) ' +
@@ -717,7 +717,7 @@ describe('#integration examples', () => {
717717 } )
718718 const session = driver . session ( )
719719
720- const writeTxPromise = session . writeTransaction ( tx =>
720+ const writeTxPromise = session . executeWrite ( tx =>
721721 tx . run ( 'CREATE (a:Item)' )
722722 )
723723
@@ -777,7 +777,7 @@ describe('#integration examples', () => {
777777 const session = driver . session ( )
778778 const titles = [ ]
779779 try {
780- const result = await session . readTransaction ( tx =>
780+ const result = await session . executeRead ( tx =>
781781 tx . run ( 'MATCH (p:Product) WHERE p.id = $id RETURN p.title' , { id : 0 } )
782782 )
783783
@@ -814,7 +814,7 @@ describe('#integration examples', () => {
814814
815815 // tag::rx-transaction-function[]
816816 const session = driver . rxSession ( )
817- const result = session . readTransaction ( tx =>
817+ const result = session . executeRead ( tx =>
818818 tx
819819 . run ( 'MATCH (p:Product) WHERE p.id = $id RETURN p.title' , { id : 0 } )
820820 . records ( )
@@ -848,7 +848,7 @@ describe('#integration examples', () => {
848848 // tag::transaction-timeout-config[]
849849 const session = driver . session ( )
850850 try {
851- const result = await session . writeTransaction (
851+ const result = await session . executeWrite (
852852 tx => addPerson ( tx , personName ) ,
853853 { timeout : 10 }
854854 )
@@ -878,7 +878,7 @@ describe('#integration examples', () => {
878878 // tag::transaction-metadata-config[]
879879 const session = driver . session ( )
880880 try {
881- const result = await session . writeTransaction (
881+ const result = await session . executeWrite (
882882 tx => addPerson ( tx , personName ) ,
883883 { metadata : { applicationId : '123' } }
884884 )
@@ -919,7 +919,7 @@ describe('#integration examples', () => {
919919 // tag::database-selection[]
920920 const session = driver . session ( { database : 'examples' } )
921921 try {
922- const result = await session . writeTransaction ( tx =>
922+ const result = await session . executeWrite ( tx =>
923923 tx . run (
924924 'CREATE (a:Greeting {message: "Hello, Example-Database"}) RETURN a.message'
925925 )
@@ -938,7 +938,7 @@ describe('#integration examples', () => {
938938 defaultAccessMode : neo4j . READ
939939 } )
940940 try {
941- const result = await readSession . writeTransaction ( tx =>
941+ const result = await readSession . executeWrite ( tx =>
942942 tx . run ( 'MATCH (a:Greeting) RETURN a.message' )
943943 )
944944
@@ -1012,10 +1012,10 @@ describe('#integration examples', () => {
10121012 // Create the first person and employment relationship.
10131013 const session1 = driver . session ( { defaultAccessMode : neo4j . WRITE } )
10141014 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' ) ) )
10171017 . then ( ( ) =>
1018- session1 . writeTransaction ( tx =>
1018+ session1 . executeWrite ( tx =>
10191019 addEmployee ( tx , 'Alice' , 'Wayne Enterprises' )
10201020 )
10211021 )
@@ -1027,10 +1027,10 @@ describe('#integration examples', () => {
10271027 // Create the second person and employment relationship.
10281028 const session2 = driver . session ( { defaultAccessMode : neo4j . WRITE } )
10291029 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' ) ) )
10321032 . then ( ( ) =>
1033- session2 . writeTransaction ( tx => addEmployee ( tx , 'Bob' , 'LexCorp' ) )
1033+ session2 . executeWrite ( tx => addEmployee ( tx , 'Bob' , 'LexCorp' ) )
10341034 )
10351035 . then ( ( ) => {
10361036 savedBookmarks . push ( session2 . lastBookmarks ( ) )
@@ -1045,9 +1045,9 @@ describe('#integration examples', () => {
10451045 } )
10461046
10471047 return session3
1048- . writeTransaction ( tx => makeFriends ( tx , 'Alice' , 'Bob' ) )
1048+ . executeWrite ( tx => makeFriends ( tx , 'Alice' , 'Bob' ) )
10491049 . then ( ( ) =>
1050- session3 . readTransaction ( findFriendships ) . then ( ( ) => session3 . close ( ) )
1050+ session3 . executeRead ( findFriendships ) . then ( ( ) => session3 . close ( ) )
10511051 )
10521052 } )
10531053 // end::pass-bookmarks[]
@@ -1506,7 +1506,7 @@ describe('#integration examples', () => {
15061506 } )
15071507
15081508 async function echo ( session , value ) {
1509- return await session . readTransaction ( async tx => {
1509+ return await session . executeRead ( async tx => {
15101510 const result = await tx . run ( 'RETURN $value as fieldName' , {
15111511 value
15121512 } )
0 commit comments