@@ -87,7 +87,7 @@ async function createReservation(client, userEmail, nameOfListing, reservationDa
87
87
{ email : userEmail } ,
88
88
{ $addToSet : { reservations : reservation } } ,
89
89
{ session } ) ;
90
- console . log ( `${ usersUpdateResults . matchedCount } document(s) found in the users collection with the email address ${ userEmail } .` )
90
+ console . log ( `${ usersUpdateResults . matchedCount } document(s) found in the users collection with the email address ${ userEmail } .` ) ;
91
91
console . log ( `${ usersUpdateResults . modifiedCount } document(s) was/were updated to include the reservation.` ) ;
92
92
93
93
// Check if the Airbnb listing is already reserved for those dates. If so, abort the transaction.
@@ -106,7 +106,7 @@ async function createReservation(client, userEmail, nameOfListing, reservationDa
106
106
{ name : nameOfListing } ,
107
107
{ $addToSet : { datesReserved : { $each : reservationDates } } } ,
108
108
{ session } ) ;
109
- console . log ( `${ listingsAndReviewsUpdateResults . matchedCount } document(s) found in the listingsAndReviews collection with the name ${ nameOfListing } .` )
109
+ console . log ( `${ listingsAndReviewsUpdateResults . matchedCount } document(s) found in the listingsAndReviews collection with the name ${ nameOfListing } .` ) ;
110
110
console . log ( `${ listingsAndReviewsUpdateResults . modifiedCount } document(s) was/were updated to include the reservation dates.` ) ;
111
111
112
112
} , transactionOptions ) ;
@@ -116,7 +116,7 @@ async function createReservation(client, userEmail, nameOfListing, reservationDa
116
116
} else {
117
117
console . log ( "The transaction was intentionally aborted." ) ;
118
118
}
119
- } catch ( e ) {
119
+ } catch ( e ) {
120
120
console . log ( "The transaction was aborted due to an unexpected error: " + e ) ;
121
121
} finally {
122
122
// Step 4: End the session
0 commit comments