mongodb connect is not a function

Solutions on MaxInterview for mongodb connect is not a function by the best coders in the world

showing results for - "mongodb connect is not a function"
Anabelle
04 May 2019
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