View all the Existing Collections in a MongoDB Database

To view all existing collections in a MongoDB database use the “show collection command“:

Syntax

show collections

Example

This command returns a list of all the existing collections in the gfgDB database.


How to Create Database and Collection in MongoDB

MongoDB stores data records as documents that are stored together in collections and the database stores one or more collections of documents.

In this article, we will look at methods to create a database and collection in MongoDB.

Similar Reads

Create a MongoDB Database

To create a database in MongoDB use the “use” command....

View all the Existing Databases

To view all existing databases in MongoDB use the “show dbs” command....

Create a Collection in MongoDB

To create a collection in MongoDB use the createCollection() method. Collection name is passed as argument to the method....

Insert Documents in Collection in MongoDB

We can insert documents in the collection using the two methods:...

View all the Existing Collections in a MongoDB Database

To view all existing collections in a MongoDB database use the “show collection command“:...

Contact Us