菜鸟的博客

纵有疾风起,人生不言弃。

导航

Mongodb使用

use MuZhaoDi
db.grade.insertMany([
  { courseName: "ComputerNetwork", score: 99, teacher: "HuYingXin", examDate: "2024/6" },
  { courseName: "MaoGai", score: 85, teacher: "MrHu", examDate: "2024/6" },
  { courseName: "ProjectMath", score: 91, teacher: "MsZhang", examDate: "2024/6" },
  { courseName: "Database", score: 95, teacher: "MrYang", examDate: "2024/6" },
  { courseName: "ProbabilityMath", score: 89, teacher: "MrBai", examDate: "2024/6" }
])
db.grade.insertOne({
  courseName: "OperatingSystem", score: 92, teacher: "MsLi", examDate: "2024/6"
})
db.grade.deleteOne({ courseName: "MaoGai" })
db.grade.updateOne({ courseName: "ProjectMath" }, { $set: { score: 93 } })
db.grade.find()
db.grade.find({ courseName: "ComputerNetwork" })
exit
sudo systemctl stop mongod

 

posted on 2024-10-16 23:06  hhmzd233  阅读(4)  评论(0编辑  收藏  举报