Skip to content

Conversation

@Dalia-Saeed
Copy link

No description provided.

@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 Dalia,

You have made a good start with your code, but it seems like you may have some files missing. Please also make sure your files follow the structure recommended in the MAKEME file, e.g. keeping all your exercise 1 code inside ex1-aggregation.

@@ -0,0 +1,29 @@

async function getPopulationByCountryPerYear(db, countryName) {
return await db.collection("population").aggregate([
Copy link

@crevulus crevulus Dec 16, 2025

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.

@@ -0,0 +1,11 @@

const { MongoClient } = require("mongodb");

Choose a reason for hiding this comment

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

You haven't included any package.json file in your changes. How should we access these third party packages?

@@ -0,0 +1,40 @@

Choose a reason for hiding this comment

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

Be very careful with leading or trailing whitespaces in file names, e.g. here your file is names homework/ index.js. This can cause big (and easily avoidable) issues when importing/exporting, referencing, pushing to git, and naming other files.

@@ -0,0 +1,11 @@

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.

await client.close();

console.log("\nRunning Aggregation Queries...");
const { db: db2, client: client2 } = await connectDB();

Choose a reason for hiding this comment

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

Are you sure you need to open/close your connection to the db multiple times? You could do it just once, run your operations, and then close at the end.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants