यदि आप किसी विशेष डेटाबेस के सभी कलेक्शन लिस्ट करना चाहते हैं, तो पहले उस डेटाबेस पर स्विच करना होगा। क्वेरी इस प्रकार है:
> use sample switched to db sample > db.getCollectionNames();
आउटपुट:
[ "copyThisCollectionToSampleDatabaseDemo", "deleteDocuments", "deleteDocumentsDemo", "deleteInformation", "employee", "internalArraySizeDemo", "sourceCollection", "updateInformation", "userInformation" ]
एक वैकल्पिक क्वेरी भी है:
> show collections;
आउटपुट:
copyThisCollectionToSampleDatabaseDemo deleteDocuments deleteDocumentsDemo deleteInformation employee internalArraySizeDemo sourceCollection updateInformation userInformation
दोनों तरीकों से आप MongoDB में किसी डेटाबेस के सभी कलेक्शन देख सकते हैं।