官网:https://www.mongodb.com/python
安装步骤:选择自定义安装,能够选择安装路径。mongodb
环境变量:指定MongoDB->bin 目录数据库
Built-In Roles(内置角色):
1. 数据库用户角色:read、readWrite;
2. 数据库管理角色:dbAdmin、dbOwner、userAdmin;
3. 集群管理角色:clusterAdmin、clusterManager、clusterMonitor、hostManager;
4. 备份恢复角色:backup、restore;
5. 全部数据库角色:readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase
6. 超级用户角色:root
// 这里还有几个角色间接或直接提供了系统超级用户的访问(dbOwner 、userAdmin、userAdminAnyDatabase)
7. 内部角色:__systemjson
首次安装,须要建立管理员用户工具
mongo学习
服务中,MongDB是自动启动的。若是没有启动,须要在服务中进行设置。rest
数据库导入:mongorestore -h localhost -d crm_db_dev --dir D://Software/Mongo/DB/crm_db_devget
数据库备份:mongodump -h localhost -d crm_db_dev -o D://Software/Mongo/DB/crm_db_devit
显示数据库:show dbs;
显示集合(表):show collections;
显示用户:show users;
切换数据库:use dbname;
数据库帮助:db.help()
集合操做命令:db.admin.help()
数据查找:db.admin.find()
条件查找:db.admin.find({a:1})
建立数据库:use dbname; db.createCollection("..."); 没法直接建立,能够经过转到进行建立
#