Tsallaka zuwa abun ciki
Justice Tech School

Delete Documents

deleteOne removes the first match and deleteMany removes all matches. drop deletes a whole collection.

Example
db.students.deleteOne({ name: "Bob" })
db.students.deleteMany({ active: false })
db.temp.drop()

Exercise

Delete all matches.

db.students.Many({ active: false })

Quiz Test

Which removes a whole collection?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.