MongoDB: List Collections – Mongo Shell

MongoDB stores data records as documents which are gathered together in collections.

Databases in MongoDB hold one or more collections of documents.

In this short note i will show how to list all collections of a database in MongoDB from the command-line using the mongo shell.

Cool Tip: To connect to a remote MongoDB server from the command-line, it needs to install MongoDB command-line client, known as mongo shell! Read More →

List Collections in MongoDB

Info: Collections in MongoDB are analogous to tables in relational databases.

To show all collections in MongoDB, first of all launch the mongo shell:

$ mongo

Select the database to use:

> show dbs
> use <databaseName>

Use one of the following command to list all collections in the selected MongoDB database:

> show collections

– or –

> show tables

– or –

> db.getCollectionNames()
Was it useful? Share this post with the world!

Leave a Reply