I'm new to MEAN stack development. I've created a database in MongoDB called 'framework' and a collection called 'users' with some json in. I can see that's all there and happy using mongo commands through Mac terminal.
Now I'm writing some Mongoose in my application and to test everything is working, I just want to get a list of the collection names. I tried this:
var mongoose = require("mongoose");
mongoose.connect("mongodb://localhost/framework");
mongoose.connection.db.collectionNames(function (err, names) {
if (err) console.log(err);
else console.log(names);
});
But when I run that file through the command line, it doesn't log anything at all. What am I doing wrong here?