MongoDB
 sql >> Datenbank >  >> NoSQL >> MongoDB

Ändern der Mongo-Datenbank

Von MongoDB 2.0.0-Treiber docs

var mongodb  = require('mongodb');
var MongoClient = mongodb.MongoClient;

var url = "mongodb://user:[email protected],db2,db3/foo?authSource=admin";

MongoClient.connect(url, function(err, db) {

    console.log("Connected correctly to server");
    console.log("Current database", db.databaseName);

    //db==foo

    db.close();

});