When I tried to connect the database in this way, it was giving this error, while I have successfully connected the database like this before.
const mongoose = require('mongoose');
require('dotenv').config();
exports.dbConnect = () => {
mongoose.connect("mongodb://localhost:27017/cloudinaryEntry", {
useNewUrlParser : true,
useUnifiedTopology : true,
})
.then( () => console.log("Database connected successfully"))
.catch( (error) => console.log("Error in connected database", error));
}
But when I added another attribute "family : 4 " then it get connected successfully. Can someone explain to me why it happened ?
const mongoose = require('mongoose');
require('dotenv').config();
exports.dbConnect = () => {
mongoose.connect("mongodb://localhost:27017/cloudinaryEntry", {
useNewUrlParser : true,
useUnifiedTopology : true,
family : 4
})
.then( () => console.log("Database connected successfully"))
.catch( (error) => console.log("Error in connected database", error));
}