Skip to content

Conversation

@dashaaaa21
Copy link

No description provided.

@dashaaaa21
Copy link
Author

@crevulus

@crevulus crevulus self-assigned this Dec 13, 2025
Copy link

@crevulus crevulus left a comment

Choose a reason for hiding this comment

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

Hi Daryna,

your code is good this week, but you've missed a few key things from the MAKEME! Please make sure you're meeting those requirements before you submit your code - you will have to do the same when you are given a ticket to complete at a real company.

@@ -0,0 +1,36 @@
const { MongoClient } = require("mongodb");

const uri = "mongodb+srv://daryna2003tk_db_user:GSjXhp3Z9lVpvTfD@cluster0.gvygkpr.mongodb.net/dbWeek4?retryWrites=true&w=majority";

Choose a reason for hiding this comment

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

Be careful! Don't commit sensitive keys/codes etc to your remote repository. Hackers may be able to access them and steal your data.

Use an env file that you keep locally.

}
}

totalPopulationByCountry("Netherlands");

Choose a reason for hiding this comment

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

I don't see a data import file in your PR. Can you explain how you got your data into your db?

From the README:

Find a way to get the data in the csv file into your MongoDB database.

populationByYear[year] += total;
});

const result = Object.keys(populationByYear).sort().map(year => ({

Choose a reason for hiding this comment

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

Instead of doing your own manual operations, try using the aggregate function to calculate this.

const populationByYear = {};

await cursor.forEach(doc => {
const year = doc.Year;

Choose a reason for hiding this comment

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

You don't need to change this now - just bear this in mind!

Something you may want to consider when you're working with CSV data: Spreadsheets often use Title Case for their headings (Country, Year, etc.). When we're designing databses, we don't usually use this case. We usually use lowercase or snake_case, removing any whitespace and standardising the cases of the letters.

When converting from CSV to database columns you might want to consider your naming conventions. But you do not need to do that for this exercise - jsut something to remember for the future as not following naming conventions will make it harder/less intuitive for other people to work with your databases.

const lastChangeFrom = accFrom.account_changes.at(-1)?.change_number || 0;
const lastChangeTo = accTo.account_changes.at(-1)?.change_number || 0;

await accounts.updateOne({ account_number: from }, {

Choose a reason for hiding this comment

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

this exercise is all about transaction functions, but this isn't a transaction!

@dashaaaa21 dashaaaa21 force-pushed the DARYNA-TKACHENKO-WEEK4-DATABASE branch from 8739135 to 45bfc1a Compare December 18, 2025 11:06
@dashaaaa21
Copy link
Author

Hi, thank you very much! I changed, could you please check
@crevulus

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