1const { MongoClient } = require("mongodb");
2
3const uri = "yourUri...";
4const databaseName = "yourDBName";
5
6MongoClient.connect(uri, { useNewUrlParser: true }, (error, client) => {
7 if (error) {
8 return console.log("Connection failed for some reason");
9 }
10 console.log("Connection established - All well");
11 const db = client.db(databaseName);
12});
13