- Advanced Node.js Development
- Andrew Mead
- 99字
- 2021-08-27 19:05:56
The deleteOne Method
Now, aside from deleteMany, we have deleteOne, and deleteOne works exactly the same as deleteMany, only it deletes the first item it sees that matches the criteria and then it stops.
To illustrate exactly how this works, we're going to create two items inside of our collection. If I give things a refresh, you will see that we now only have two documents:
These are the ones we started with. I'm going to insert documents again using the same data that's already in my clipboard. This time we'll just make two document, two that are identical.