
- MongoDB Tutorial
- MongoDB - Home
- MongoDB - Overview
- MongoDB - Advantages
- MongoDB - Environment
- MongoDB - Data Modeling
- MongoDB - Create Database
- MongoDB - Drop Database
- MongoDB - Create Collection
- MongoDB - Drop Collection
- MongoDB - Data Types
- MongoDB - Insert Document
- MongoDB - Query Document
- MongoDB - Update Document
- MongoDB - Delete Document
- MongoDB - Projection
- MongoDB - Limiting Records
- MongoDB - Sorting Records
- MongoDB - Indexing
- MongoDB - Aggregation
- MongoDB - Replication
- MongoDB - Sharding
- MongoDB - Create Backup
- MongoDB - Deployment
- MongoDB - Java
- MongoDB - PHP
- Advanced MongoDB
- MongoDB - Relationships
- MongoDB - Database References
- MongoDB - Covered Queries
- MongoDB - Analyzing Queries
- MongoDB - Atomic Operations
- MongoDB - Advanced Indexing
- MongoDB - Indexing Limitations
- MongoDB - ObjectId
- MongoDB - Map Reduce
- MongoDB - Text Search
- MongoDB - Regular Expression
- Working with Rockmongo
- MongoDB - GridFS
- MongoDB - Capped Collections
- Auto-Increment Sequence
- MongoDB Useful Resources
- MongoDB - Questions and Answers
- MongoDB - Quick Guide
- MongoDB - Useful Resources
- MongoDB - Discussion
Display collections in a particular MongoDB database?
At first, switch to a particular database in MongoDB with the USE command as in the below syntax −
use yourDatabaseName; db.getCollectionNames();
Let us implement the above syntax to display collections of database WEB −
> use web; switched to db web > db.getCollectionNames();
This will produce the following output −
[ "2015-myCollection", "2015-yourCollection", "2019-employeeCollection", "addColumnDemo", "applyConditionDemo", "calculateAverage", "calculateSumOfDocument", "changeSimpleFieldDemo", "check", "checkFieldDemo", "collationExample", "compoundIndexDemo", "countandsumdemo", "creatingAliasDemo", "decreasetimeusingindex", "demo1", "demo10", "demo11", "demo12", "demo13", "demo14", "demo15", "demo16", "demo17", "demo18", "demo19", "demo2", "demo20", "demo21", "demo22", "demo23", "demo24", "demo25", "demo26", "demo27", "demo28.example", "demo29", "demo3", "demo30", "demo31", "demo32", "demo33", "demo34", "demo35", "demo36", "demo37", "demo38", "demo39", "demo4", "demo5", "demo6", "demo7", "demo8", "demo9", "destinationCollection", "emp_info", "emptyCollection", "extractParticularElementDemo", "getSpecificData", "getTheMaxValueDemo", "indexCreationDemo", "missingDocumentDemo", "promoteSubfieldsDemo", "pullWithPositionalOperatorDemo", "removeNullDemo", "replacevaluedemo", "searchDocumentsDemo", "searchSubFieldDemo", "sourceCollection", "splitString", "testInArray", "twoSpecificIdsDemo", "updatingDemo", "version" ]
- Related Articles
- How to list all collections from a particular MongoDB database?
- How to list all the Collections in a MongoDB database using Java?
- How to reach subdata in MongoDB and display a particular document?
- Drop all indexes from all the collections in a MongoDB database using the command line?
- Create and display the newly created database in MongoDB?
- To display a database in the SHOW dbs list, do we need to add collections to it?
- Is there a way to list collections in MongoDB?
- How to loop through collections with a cursor in MongoDB?
- Removing all collections whose name matches a string in MongoDB
- Find all collections in MongoDB with specific field?
- Display records after a particular date in MySQL
- Display IDs in a particular order with MySQL IN()?
- How to drop a database in MongoDB?
- Stop and start a particular database service in SAP HANA
- Particular field as result in MongoDB?

Advertisements