BASIC MONGODB COMMANDS

basic bottles of mongoDB commands

Hi all, this is just my personal dev notes that I keep here so I can get a reminder from time to time. I’ve recently started to play around with Mongdb with great success using the MEAN stack approach, so I wont be going through the setting up but just some basic commands to get you going and started.

RUN COMMAND

mongo

CREATE A NEW TABLE COMMAND

use DBNAME

Once successful you will see the command line mention that you have “switched to db DBNAME”

SHOW DATABASE LIST COMMAND

show dbs

The terminal will list the available databases.

INSERT DOCUMENT INTO DATABASE

db.DBNAME.insert({
         firstName: "Tony", 
         lastName: "Marques",
         avatar: "01"
})

// result should show 
WriteResult({ "inserted" : 1 })

Hope this helps you quickly along. I am using MongoDB Compass Version 1.29.5 and node v14.18.0

firebase init command not found

boringimageyouarenotmissingout

TLDR below, as for now work has been more challenging and only now i’ve started working on some personal projects..well just project.

To become more familiar with firebase I went through this tutorial and it gets you up and connected. Also shows you the basic crud calls which is handy.

I started a new project and tried to follow the tutorial and I wanted to firebase init but the command was not found. Seeing that i’ll probably come across this again i have decided to make a lil dev note on this.

TLDR

Macbook:projectName tony$ firebase init
-bash: firebase: command not found
Macbook:projectName tony$ npm install -g firebase-tools

Install firebase tools globally by installing the following rpm package

npm install -g firebase-tools

There is also a chance that you are not signed into firebase yet. The terminal should prompt you to run “firebase login”.

firebase login

After successfully logging in you can run the following command

firebase init

Have a great day and good luck