Creating a DB in MongoDB

It is as simple as calling an URL

If you have already installed MongoDB.

If Not go-ahead download from here

var MongoClient = require('mongodb').MongoClient;
//Create a database named "testdb":
var url = "mongodb://localhost:27017/testdb";

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  console.log("Database created!");

Leave a Reply

Your email address will not be published. Required fields are marked *