Grokking MongoDB
Vote

0% completed

​

Delete Operations

Suppose a user asks to close an account, and your application must remove that user's document. The command is short, but MongoDB does not ask for confirmation and has no undo. If the filter is wrong, the wrong documents are gone, and only a backup can bring them back. Choosing the filter is therefore the main skill in deleting data.

This lesson uses six users, and the examples run in order. Note that there are two users named Bob.

db.users.drop() db.users.insertMany([ { _id: ObjectId("507f1f77bcf86cd799439011"), name: "Alice", age: 25,

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content