如何列出特定 MongoDB 資料庫中的所有集合?
如果你想列出特定資料庫中的所有集合,則需要首先切換資料庫。查詢如下 −
> 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
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式語言
C++
C#
MongoDB
MySQL
Javascript
PHP