I have used MongoDb and Node Js before, unfortunately after reinstalling the two which is after formatting the laptop, connecting the database to Node Js seemingly is not working.
Below is my code
codeimage for the code
Output
I have used MongoDb and Node Js before, unfortunately after reinstalling the two which is after formatting the laptop, connecting the database to Node Js seemingly is not working.
Below is my code
codeimage for the code
Output
2
Answers
With regards to MongoDB update, instead of using 'localhost' one is required to use '127.0.0.1'.
Example instead of:
mongodb://localhost:27017/Company
, one is supposed to write it as;mongodb://127.0.0.1:27017/Company
I was also facing the same problem but now I’m using following code and is working for me
server.js