// Procedure
**Stop the container(s) using the following command:
docker-compose down
**Delete all containers using the following command:
docker rm -f $(docker ps -a -q)
| -- Simulate creating booking.com database | |
| SHOW DATABASES; | |
| CREATE DATABASE booking_company; | |
| USE booking_company; | |
| SELECT DATABASE (); | |
| SHOW CREATE DATABASE booking_company; | |
| -- create guests table | |
| CREATE TABLE guests ( | |
| id INT NOT NULL AUTO_INCREMENT, |
// Procedure
**Stop the container(s) using the following command:
docker-compose down
**Delete all containers using the following command:
docker rm -f $(docker ps -a -q)
| Container Management Commands | |
| // docker create image [Create the container] | |
| // docker run image [start the image] | |
| // docker start container [start the container] | |
| // docker stop container [graceful stop] | |
| // docker kill container [kill container] | |
| // docker restart container [stop + start] | |
| // docker pause container [suspends container] | |
| // docker unpause container [resume container] |
Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
$ npm install mongodb
Register:
| // I used Datagrip in my crash course, but you can use the mongodb shell and you'll ge tthe same results. | |
| //Friday, 18th June, 2021 | |
| //mongoDB basic commands and queries | |
| //To show all databases | |
| show dbs | |
| //To switch(choose) a database | |
| use sampleDatabase |
| // Add this code snippet to your settings.json file: | |
| "emmet.includeLanguages": { | |
| "javascript": "javascriptreact" | |
| }, | |
| "emmet.triggerExpansionOnTab": true |