MongoDB基本使用
一、打开cmd窗口,切换至mongoDB bin目录,执行mongo,打开shell,shell即mongoDB客户端
注意:mongoDB启动窗口不能关闭,否则执行mongo会报错
第一次使用,需执行use test ,指定test数据库;创建集合db.createCollection(name,options),集合可用不用单独创建,创建文件时会自动插入集合
show collections 显示所有已创建的集合,mongoDB的文件格式都是bson,MongoDB使用了BSON这种结构来存储数据和网络数据交换
二、基本操作
插入命令:db.info.insert({"name":"rosa"})
查找命令:db.info.find({"name":"rosa"})
db.info.find() 查找info集合下所有值