Connecting Mongo DB with NodeJS
To use mongo Db with the Node here we can use Mongoose npm package and mlab.com as mongo db cloudeservice provider. Setup the mlab account mlab.com provides the initial 500MB free account for new users. Create an account in mlab.com Select "Create new" in MongoDB Deployments Click on free "Sandbox" account plan Enter the Database name for example "diary" DB has been created Highlighted text shows the DB URI link by which we can connect with DB. Now install mongoose package in Node Js by npm install mongoose --save in CLI Node js code is below to connect Node Js with Mongo DB. In below code we will create two documents in DB. var express = require( 'express' ); var mongoose = require( 'mongoose' ); var app = express(); //connecting to the DB mongoose.connect( 'mongodb://sarthakdb:123ertyu@ds243345.mlab.com:43345/diary' ); //creating a Schema var Sch...