title: TypeError: db.admin is not a function
body: <p>I'm learning Mongo DB, I'm trying to list all the dbs,I got this error after giving URL to the </p>
  
  <pre><code>var dbAdmin=db.admin()
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>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);
      })
      });</code></pre>
  </div>
  </div>
  
         var dbAdmin=db.admin();
                         ^</p>
  
  <p>TypeError: db.admin is not a function</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>