Search code examples
reactjsmongodbexpressnodemon

Getting ERROR while connecting MongoDB database to express server


Error: node: internal /errors :465 ErrorCaptureStackTrace(err) ;

enter image description here

Here is my code:

import express from "express";
import bodyParser from "body-parser";
import mongoose from "mongoose";

const app = express();
app.use(bodyParser.json({ Limit: "30mb", extended: true }));
app.use(bodyParser.urlencoded({ limit: "30mb", extended: true }));

mongoose.connect ("My Uri").
then(()=>app.listen(5000, ()=>console.log("Listening")));

Solution

  • Can you check if your IP is whitelisted from your MongoDB atlas?