I'm learning Mongo DB, I'm trying to list all the dbs,I got this error after giving URL to the
var dbAdmin=db.admin()
var mongoClient = require('mongodb').MongoClient;
mongoClient.connect("mongodb://localhost/",
{useUnifiedTopology: true,useNewUrlParser:true, poolSize: 5, reconnectInterval: 500 },
function(err,db){
console.log("DATABASE IS BEING LOGGED...." ,db);
var dbAdmin=db.admin();
dbAdmin.listDatabases(function (err,databases) {
console.log("before adding databases");
console.log(databases);
})
});
TypeError: db.admin is not a function
I have consoled the DB object it returns JSON, it does not have the function I have followed this code from the book Node.js, MongoDB and Angular Web Development, by brad dayley 2018 edition