I\'m trying to return a list of a dbs collections using mongoose. I\'m following the directions set out here but http://grokbase.com/t/gg/mongoose-orm/122xxxr7qy/mongoose-ge
Try running your collection names function after connection.
mongoose.connection.on('open', function (ref) {
console.log('Connected to mongo server.');
//trying to get collection names
mongoose.connection.db.listCollections().toArray(function (err, names) {
console.log(names); // [{ name: 'dbname.myCollection' }]
module.exports.Collection = names;
});
})