📜  mongodb.connect 不是函数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:58.477000             🧑  作者: Mango

代码示例1
const { MongoClient } = require("mongodb");

const uri = "yourUri...";
const databaseName = "yourDBName";

MongoClient.connect(uri, { useNewUrlParser: true }, (error, client) => {
  if (error) {
    return console.log("Connection failed for some reason");
  }
  console.log("Connection established - All well");
  const db = client.db(databaseName);
});