JavaScript
> db.getMongo().getDBNames()
[
    "test",
    "admin",
    "local"
]
> db.getMongo().getDBNames
function () {
    return this.getDBs().databases.map(function (z) {return z.name;});
}