Skip to content

Commit

Permalink
Merge pull request #10 from mongodb-developer/transactions
Browse files Browse the repository at this point in the history
Add missing semicolons
  • Loading branch information
ljhaywar committed Dec 10, 2019
2 parents 2873d58 + ea98827 commit 6e07c6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async function createReservation(client, userEmail, nameOfListing, reservationDa
{ email: userEmail },
{ $addToSet: { reservations: reservation } },
{ session });
console.log(`${usersUpdateResults.matchedCount} document(s) found in the users collection with the email address ${userEmail}.`)
console.log(`${usersUpdateResults.matchedCount} document(s) found in the users collection with the email address ${userEmail}.`);
console.log(`${usersUpdateResults.modifiedCount} document(s) was/were updated to include the reservation.`);

// Check if the Airbnb listing is already reserved for those dates. If so, abort the transaction.
Expand All @@ -106,7 +106,7 @@ async function createReservation(client, userEmail, nameOfListing, reservationDa
{ name: nameOfListing },
{ $addToSet: { datesReserved: { $each: reservationDates } } },
{ session });
console.log(`${listingsAndReviewsUpdateResults.matchedCount} document(s) found in the listingsAndReviews collection with the name ${nameOfListing}.`)
console.log(`${listingsAndReviewsUpdateResults.matchedCount} document(s) found in the listingsAndReviews collection with the name ${nameOfListing}.`);
console.log(`${listingsAndReviewsUpdateResults.modifiedCount} document(s) was/were updated to include the reservation dates.`);

}, transactionOptions);
Expand All @@ -116,7 +116,7 @@ async function createReservation(client, userEmail, nameOfListing, reservationDa
} else {
console.log("The transaction was intentionally aborted.");
}
} catch(e){
} catch (e) {
console.log("The transaction was aborted due to an unexpected error: " + e);
} finally {
// Step 4: End the session
Expand Down

0 comments on commit 6e07c6c

Please sign in to comment.