Connecting to MongoDB in Node.js
August 19, 2023
⭕ Overview
In this video, we’ll make a connection to a MongoDB database using the mongodb module in Node.js.
Note: For local MongoDB databases, use the IP address “127.0.0.1” instead of “localhost” because Node.js 18 and up prefer IPv6 addresses. This means, on many machines, Node.js will resolve “localhost” to the IPv6 address “::1” and it might be unable to connect, unless the mongodb instance is running with ipv6 enabled.