Install MongoDB, Redis, ExpressJS

How to install Mongo DB
brew update
brew install mongodb

Installing and running MongoDB on Mac OSX for beginners!

Install Redis:
brew install redis

Start Redis server:

Get Redis info:
brew info redis

npm install mongojs –save (to install mongojs for connection with mongoDB with nodejs)

nmp init
npm install express –save ( to install express nodejs framework)

Install expressjs framework and run express hello world test application (

Set environment vairable:
export MONGO_HOST=mongodb://localhost/db

Start nodejs server:
Npm start

On terminal run command mongod to start mongo:

Mongojs module for mongo connection with nodejs

For backup or dump mongoDB
mongodump –db databasename (this command will run in terminal)

For import mongoDB go to backup folder and run command in terminal

Basic mongoDB commands or we can use mongoDB Compass for UI: (

1. Create new mongoDB:
Use testdb

2. Create table in mongoDB:

3. Show table list in mongoDB:
show collections

4. Insert into mongoDB user collection(table):
db.user.insert([{name:’Sam’, email:’’},{name:’Jhon’,email:’’}])

5. Select all rows from user collection (table):

Leave a Reply

Your email address will not be published. Required fields are marked *