List of collection names in MongoDB using Monk
1 answer
This will usually do it, but it requires some digging into the underlying driver:
var db = require('monk')('localhost/test');
db.on("open",function() {
console.log(
db.driver._native.command(
{ "listCollections": 1 },
function(err,result) {
console.log( result.cursor.firstBatch.map(function(el) {
return el.name;
}))
}
)
);
});
The driver command is of course "listCollections" and these are the main hoops to jump over to get there
+1
source to share