Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
$ npm install mongodb
Register:
| // Add this code snippet to your settings.json file: | |
| "emmet.includeLanguages": { | |
| "javascript": "javascriptreact" | |
| }, | |
| "emmet.triggerExpansionOnTab": true |
| // 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 |
Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
$ npm install mongodb
Register:
| 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] |
// 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, |
| # Program to display the Fibonacci sequence up to n-th term | |
| nterms = int(input("How many terms? ")) | |
| # first two terms | |
| n1, n2 = 0, 1 | |
| count = 0 | |
| # check if the number of terms is valid | |
| if nterms <= 0: |
| for fizzbuzz in range(51): | |
| if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0: | |
| print("fizzbuzz") | |
| continue | |
| elif fizzbuzz % 3 == 0: | |
| print("fizz") | |
| continue | |
| elif fizzbuzz % 5 == 0: | |
| print("buzz") | |
| continue |
| using namespace System.Management.Automation | |
| using namespace System.Management.Automation.Language | |
| # S way | |
| # oh-my-posh --init --shell pwsh --config ~/jblab_2021.omp.json | Invoke-Expression | |
| # S theme | |
| # oh-my-posh --init --shell pwsh --config C:\Users\amirb\AppData\Local\Programs\oh-my-posh\themes\ohmyposhv3-v2.json | Invoke-Expression | |
| # OMP way |
| First, delete package-lock.json and node modules | |
| Second, run the command : npm cache clean --force | |
| Next, run the command : npm install | |
| Finally, you should be able to run your react server : npm start |