Open vishwaefor opened 5 years ago
Step 1 Create an free account in MongoDB Atlas and take the connection String for Node.js driver
Step 2 Install mongoose using npm install mongoose --save
npm install mongoose --save
Step 3 Update app.js to use mongoose connection const mongoose = require('mongoose'); const connection = mongoose.connect('replace the connection string taken above', {useNewUrlParser: true}); connection .then((db) => { console.log("Connected correctly to server"); }) .catch((err) => { console.log(err) });
const mongoose = require('mongoose');
const connection = mongoose.connect('replace the connection string taken above', {useNewUrlParser: true});
connection .then((db) => { console.log("Connected correctly to server"); }) .catch((err) => { console.log(err) });
Steps
Step 1 Create an free account in MongoDB Atlas and take the connection String for Node.js driver
Step 2 Install mongoose using
npm install mongoose --save
Step 3 Update app.js to use mongoose connection
const mongoose = require('mongoose');
const connection = mongoose.connect('replace the connection string taken above', {useNewUrlParser: true});
connection .then((db) => { console.log("Connected correctly to server"); }) .catch((err) => { console.log(err) });