Answers for "Node.JS mongodb create database"

1

Node.JS mongodb create database

var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/mydb";

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  console.log("Database created!");
  db.close();
});
Posted by: Guest on March-11-2021

Code answers related to "Node.JS mongodb create database"

Code answers related to "Javascript"

Browse Popular Code Answers by Language