1.几个重要的网站:
MongoDB官网:www.mongodb.org
MongoDB国内官网站:www.mongoing.com
2.windows安装配置:https://blog.csdn.net/heshushun/article/details/77776706
3.mongodb可视化工具:https://www.cnblogs.com/shiweida/p/7692468.html (没有成功可能是配置没对,或者不支持mongodb4.0)
https://www.cnblogs.com/wolf-sun/p/5624828.html(这个工具成功使用)
4.数据库连接:客户端连接:使用bin目录下的mongo.exe进行连接。
5.相关命令:
db.shutdownServer() 切断服务
db.dropDatabase() 关闭数据库
use imooc自动创建数据库并切换数据库
show dbs
show tables
show collections
use imooc 创建并使用imooc数据库
db.imooc_collection.insert({x:1}) 创建imooc_collection集合并插入一条文档
db.imooc_collection.find() 查询imooc_collection集合中所有文档
db.imooc_collection.find({x:1}) 查询附带条件的文档
for(i=3;i<20;i++)db.imooc_collection.insert({x:i}) 循环向imooc_collection集合中插入文档
db.imooc_collection.find().count() 统计imooc_collection集合中文档的数量
db.imooc_collection.update({x:1},{999})
db.imooc_collection.update({z:1},{$set:{y:100}}) (部分更新)将imooc_collection集合中z为1的文档中的y值更新为100
db.imooc_collection.update({y:99},{y:12},true) 如果y=99不存在则创建y:12
之前的update操作只能更新所选条件的一个文档
更新多条数据:db.imooc_collection.update({x:1},{$set:{x:78}},false,true)
db.imooc_collection.remove({x:1}) 删除文档
db.imooc_collection.drop() 删除集合
索引:
db.imooc_collection.getindexes() 查询索引
单键索引:
db.imooc_collection.ensureIndex({x:10})
以上只是基础知识总结