【学习笔记】MongoDB笔记
MacOS 命令
开启mongodb Server
1 | brew services start mongodb-community@6.0 |
关闭mongodb Server
1 | brew services stop mongodb-community@6.0 |
创建用户
mongoDB对某一个数据库进行操作需要先创建一个对该数据库有相关权限的用户
首先打开某一个数据库use dbname
输入db.createUser({user:'username',pwd:'password',roles:[{role:'dbOwner',db:'dbname'},{role:'dbOwner',db:'dbname'}]})
查询数据
查看数据库
show databases
查看有哪些表/集合
show tables/show collections
查看某一表中的全部内容
db.table_name.find()
- 标题: 【学习笔记】MongoDB笔记
- 作者: Thou
- 创建于 : 2022-10-17 23:12:09
- 更新于 : 2024-12-19 15:27:27
- 链接: https://blog.txgde.space/2022/10/17/【学习笔记】MongoDB笔记/
- 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论