Question – How do I list all the collections available in the MongoDB database?
MongoDB is a NoSQL database, that stores documents in JSON format. A collection is an entity in MongoDB (ie similar to a table in RDBMS databases) that stores JSON documents.
You can use one of the below options to list collections in a MongoDB database.
- Mongo Shell: You can use one of the following commands from Mongo Shell to list all available collections in the MongoDB database. Before running the below commands you must be connected with the target database using
- Node.js: Use
listCollections()method to list all collections in database with Node.js application. The application must have created a connection to the MongoDB database before.
Thanks, hope this quick how-to guide helps you to find all collections in a MongoDB database.