Curd operations

db.createCollection('students')
db.students.insertOne({ "rollno": 1, "name": "Ranchoddas Shamaldas Chanchad", "age": 21, "marks": 42, "dept": "AI&DS", "fees": 120000 })
db.students.insertMany([
  { "rollno": 2, "name": "Raju Rastoji", "age": 21, "marks": 56, "dept": "IT", "fees": 85000 },
  { "rollno": 3, "name": "Virus", "age": null, "marks": null, "dept": "IT", "fees": 85000 },
  { "rollno": 4, "name": "Milimeter", "age": null, "marks": null, "dept": "IT", "fees": 85000 },
  { "rollno": 5, "name": "Priya", "age": null, "marks": null, "dept": "AI&DS", "fees": 120000 }
])
db.students.find()
db.students.find({ "dept": "IT" })
db.students.find({ "age": { $gt: 20 } })
db.students.updateOne({ "rollno": 3 }, { $set: { "marks": 90 } })
db.students.updateMany({ "dept": "IT" }, { $set: { "age": 22 } })
db.students.deleteOne({ "rollno": 4 })
db.students.deleteMany({ "marks": null })

top

Copyright © Aditya Godse

The charts are created using mermaid.js