Skip to content

Conversation

@YaroslavKazeev
Copy link

No description provided.

@yunchen4 yunchen4 self-assigned this Sep 19, 2025
Copy link

@yunchen4 yunchen4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Yaroslav,
The assignment looks good to me! Only a small point that needs rework.
Please let me know once you finish rework. Thanks!

Comment on lines 25 to 32
await account.updateOne(
{ account_number: receiver_account_number },
{ $inc: { balance: amount } },
{
$push: { account_changes: { amount: amount, changed_date, remark } },
},
{ session }
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rework: the position of $push is wrong for the second updateOne.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +35 to +36
} catch (error) {
console.log("Transaction aborted.", error);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: It's ok in the assignment to use simple error handling (just logging). In real working situation, usually the error will be thrown or return some thing that clearly differentiates the normal state without error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@YaroslavKazeev
Copy link
Author

Thanks for your suggestions, Chen

Copy link

@yunchen4 yunchen4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants