cd /opt/mongoDB/bin
#连接mongodb
./mongo
#查询数据库
show dbs;
#选择数据库
use arknews;
#查看表
show tables;
#查询
db.news_category.find()
#根据id删除数据
db.users.deleteOne({ _id: ObjectId("你的文档ID") });
#根据id修改数据
db.news_category.save({ "_id" : ObjectId("5f6c90b09219335e27080672"), "level" : "1", "name" : "行业动态", "level2Vos" : [ { "level" : "2", "name" : "头部公司" }] })
新建表
db.createCollection("myCollection");
1204

被折叠的 条评论
为什么被折叠?



