title: Trying to get a list of collections from mongoose
body: <p>I'm trying to return a list of a dbs collections using mongoose. I'm following the directions set out here but <a href="http://grokbase.com/t/gg/mongoose-orm/122xxxr7qy/mongoose-get-a-list-of-all-collections">http://grokbase.com/t/gg/mongoose-orm/122xxxr7qy/mongoose-get-a-list-of-all-collections</a>. So here is my code    </p>
  
  <pre><code>var mongoose = require('mongoose');
      //if (mongoose.connection.readyState == 0){//checks if already connected to the database
      console.log("creating connection to the database");
      var Config = require('../configs/config');
      var config = new Config();
      config = config.getConfig().db.dev;
  
      if (mongoose.connection.readyState = 0 ) {
      mongoose.connect("mongodb://austin:password1@paulo.mongohq.com:10023/test1");
      console.log('mongoose readyState is ' + mongoose.connection.readyState);
      }
      var collection;
  
      mongoose.connection.on('open', function (ref) {
          console.log('Connected to mongo server.');
      });
  
      //trying to get collection names
      mongoose.connection.db.collectionNames(function (err, names) {
          console.log(names); // [{ name: 'dbname.myCollection' }]
          module.exports.Collection = names;
      });
  </code></pre>
  
  <p>the only problem is that names returns as undefined. So is it even possible to return a list of collections using just vanilla mongoose?</p>