How to view table information in MongoDB?
You can use the following command in MongoDB to view table information:
- Use the ‘show collections’ command to display all collection (table) names in the current database.
show collections
- Use the command db.collectionName.stats() to view statistical information about a specific collection, such as the number of documents and data size.
db.collectionName.stats()
- Use the command db.collectionName.find() to view all document data in the specified collection (table).
db.collectionName.find()
By using the above command, you can view basic information about tables in MongoDB as well as data within the tables.