When using MongoDB, there’s more than one way to list the collections in a database.
Here are four ways to get a list of collections in a MongoDB database:
- The
show collections
Command - The
listCollections
Command - The
db.getCollectionNames()
Method - The
db.getCollectionInfos()
Method