背景:
长时间不操作mongodb数据库,已经遗忘了命令,今天正好用到,温习一下
直接上命令
#进入mongodb数据库安装bin目录
cd /opt/mongodb/bin
#连接mongodb
./mongo
#查看所有的数据库
show dbs;
#选择数据库
use xx;
#查看表
show tables;
#查询
db.xxx.find()
db.xxx.find()
#根据id删除数据
db.xxx.deleteOne({ _id: ObjectId("你的文档ID") });