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 collectionsCommand - The
listCollectionsCommand - The
db.getCollectionNames()Method - The
db.getCollectionInfos()Method