How do I return result" when collection.each is finish? I tried using map but collection isn't an array.
function(arg) {
var result = [];
db = MongoInternals.defaultRemoteCollectionDriver().mongo.db;
collections = db.listCollections();
collections.each(function(n, collection) {
if (collection) {
result.push(collection.name)
}
});
return result;
}