mongodb print collection names code example
Example 1: list all collections in the MongoDB shell
JavaScript (shell):
db.getCollectionNames()
Node.js:
db.listCollections()
Example 2: getcollectionnames
// Returns an Array containing names of all collection
// in the current Database
db.getCollectionNames()