-
Notifications
You must be signed in to change notification settings - Fork 9
Dalia-assignment-w4 #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Dalia-assignment-w4 #32
Conversation
crevulus
left a comment
There was a problem hiding this 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([ | |||
There was a problem hiding this comment.
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"); | |||
There was a problem hiding this comment.
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 @@ | |||
|
|
|||
There was a problem hiding this comment.
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 @@ | |||
|
|
|||
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
No description provided.