Installing MongoDB

suggest change
npm install mongodb
# Mongoose is a schema wrapper around the driver
npm install mongoose

In the server file (index.js or server.js). Mongoose 6 removed the connect callback; the call returns a promise. The scheme is mongodb://, not http://.

const mongoose = require('mongoose');
const mongoConnectString = 'mongodb://localhost:27017/databaseName';

mongoose.connect(mongoConnectString).catch((err) => {
  console.error('Could not connect to the database', err);
});

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents