Conversation
crevulus
left a comment
There was a problem hiding this comment.
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([ | |||
There was a problem hiding this comment.
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.
Week4/homework/ db.js
Outdated
| @@ -0,0 +1,11 @@ | |||
|
|
|||
| const { MongoClient } = require("mongodb"); | |||
There was a problem hiding this comment.
You haven't included any package.json file in your changes. How should we access these third party packages?
Week4/homework/ index.js
Outdated
| @@ -0,0 +1,40 @@ | |||
|
|
|||
There was a problem hiding this comment.
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.
Week4/homework/ db.js
Outdated
| @@ -0,0 +1,11 @@ | |||
|
|
|||
There was a problem hiding this comment.
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.
Week4/homework/ index.js
Outdated
| await client.close(); | ||
|
|
||
| console.log("\nRunning Aggregation Queries..."); | ||
| const { db: db2, client: client2 } = await connectDB(); |
There was a problem hiding this comment.
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.
No description provided.