Mongodb数据库创建实例
启动MongoDB
创建数据库
在Mongo命令行窗口输入 use dbName,按5执行。其中dbName是新建数据库名。
输入 show dbs显示如下 local 0.000025GB test 0.00002GB
创建的数据库(newdb)不在列表中。要显示数据库,需要至少插入一个文档,空的数据库是不显示出来的。
>db.items.insert({"name":"yiibai tutorials"})
>show dbs
local 0.00005GB
test 0.00002GB
newdb 0.00002GB
在 MongoDB 中默认数据库是:test。 如果您还没有创建过任何数据库,则集合/文档将存储在test数据库中。
