list all mongodb commands code example Example: list all collections in the MongoDB shell JavaScript (shell): db.getCollectionNames() Node.js: db.listCollections()