当我想知道mongodb中有哪些数据库以及数据库中有哪些集合(等于SQL中的show tables
语句)时,我应该使用什么命令?我只在文档中找到了{dbStats:1}
,这些文档只能显示当前数据库的信息,而没有集合列表。
请参阅官方文件:
show dbs displays all the databases on the server you are connected to
use db_name switches to db_name on the same server
show collections displays a list of all the collections in the current database
是show dbs
和show collections
:
http://www.mongodb.org/display/DOCS/Overview+-++MongoDB+Interactive+Shell#概述MongoDB Interactive Shell SelectDatabase