-
Notifications
You must be signed in to change notification settings - Fork 0
Dockerized version #3
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
Conversation
Suggestion: Consider scripts to package.json that cleans up the container and volumes and provides student the ability to start clean. For example |
README.md
Outdated
4. **Import Data into MongoDB**: Import the restaurant data into the MongoDB database by executing: | ||
|
||
``` | ||
docker exec -i your_container_name mongoimport --db practice --collection restaurants --drop --file /home/mongodb/restaurants.json --authenticationDatabase admin --username root --password example |
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.
Suggestion: Since this isn't a docker practice assignment, I suggest leveraging the power of npm by adding a package.json file with scripts that can automate these commands.
A command to clean the database volume, a command to copy the resources, and a quick command to login to mongosh.
Students can then use npm run COMMAND
to make things easier for them. They are also used to using npm and yarn more than docker
* add scripts to package.json * add resest to readme.md * fix indintation in script.js
@wisammechano PTAL |
version: "3" | ||
services: | ||
mongodb: | ||
image: mongo:5.0 |
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 suggest hard coding the container name here and then reference it in package.json
instead of relying on the auto generated container name
container_name: recoded-mongodb-queries-practice-assignment
"start": "docker-compose up -d", | ||
"stop": "docker-compose down", | ||
"verify": "docker ps", | ||
"copy-data": "docker cp ./restaurants.json curriculum-backend-mongodb-queries-practice-mongodb-1:/home/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.
replace auto generated container name with the hard coded container name.
PS: Apply to other commands too
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.
lgtm
Changes