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:
Redis-server

Get Redis info:
brew info redis

npm install mongojs –save (to install mongojs for connection with mongoDB with nodejs)
https://github.com/mafintosh/mongojs

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

Install expressjs framework and run express hello world test application (https://expressjs.com/en/starter/generator.html)

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
https://github.com/mafintosh/mongojs

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
mongorestore

Basic mongoDB commands or we can use mongoDB Compass for UI: (https://www.mongodb.com/download-center/compass)

1. Create new mongoDB:
Use testdb

2. Create table in mongoDB:
db.createCollection(‘user’)

3. Show table list in mongoDB:
show collections

4. Insert into mongoDB user collection(table):
db.user.insert([{name:’Sam’, email:’info@talkforweb.com.au’},{name:’Jhon’,email:’jhon@talkforweb.com.au’}])

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