Reputation: 165
This both operations delete one object. Is there any performance difference between them or both are same?
Upvotes: 2
Views: 3154
Reputation: 6672
findOneAndDelete has the sort
parameter which can be used to influence which document is updated. It also has a TimeLimit parameter which can control within which operation has to complete.
From the docs : https://docs.mongodb.com/v3.2/reference/method/db.collection.findOneAndDelete/
Deletes a single document based on the filter and sort criteria, returning the deleted document.
https://docs.mongodb.com/manual/reference/method/db.collection.deleteOne/
Removes a single document from a collection.
Upvotes: 1