DEV Community

mohammad adnan
mohammad adnan

Posted on


connect MongoDB to Node.js

Don't get too confuse while connecting MongoDB
to Node.js because people use different ways to connect it

  1. after intalling dependencies and making .env file mention your connection link of mongodb and port in env file this way will also work when you deploy your project. just remove the mongodb compass link to mongodb atlas link.because on onrender and heroku you have to mention in in enviroment variables separately and below pic will help you to solve your doubts

Image description

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.