mongodb how to get all collections code example
Example 1: list all collections in the MongoDB shell
JavaScript (shell):
db.getCollectionNames()
Node.js:
db.listCollections()
Example 2: get all data in collection mongodb
db.collection_name.find().pretty()