Skip to content

Conversation

@hussam-it-max
Copy link

No description provided.

@hussam-it-max hussam-it-max changed the title Assignment-w3-database Hussam-w3-database Sep 9, 2025
@yunchen4 yunchen4 self-assigned this Sep 12, 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.

LGTM, only some suggestions for code maintainability

Comment on lines +7 to +9
if(res.rows[0].balance<=1000){
throw new Error('Insufficient funds in account 101');
}

Choose a reason for hiding this comment

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

Nice check of balance beforehand. You can also check whether the accounts exist.

* It seems an errand episode has gotten into our data.
* This is episode 14 in season 31. Please remove it and verify that it has been removed!
*/
const deleteResult=await client.db('DatabaseWeek3').collection('bob_ross_episodes').deleteOne({episode:'S31E14'})

Choose a reason for hiding this comment

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

Suggestion: you may notice client.db('DatabaseWeek3').collection('bob_ross_episodes') appears multiple times in this file. In this case, you can extract it into another function. You can also have two string constants for "databaseWeek3" and "bob_ross_episodes", so you can reuse those strings and avoid typos in future. And in future if you want to change database name, you don't need to change them one by one.

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