mongodb create database javascript code example
Example 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();
});
Example 2: how to create database in mongo db command
use DATABASE_NAME