In MongoDB the db.collection.findOneAndDelete() method deletes a single document, and returns the deleted document.
It deletes the first matching document in the collection that matches the filter. The sort parameter can be used to influence which document is deleted.
The collection part is the name of the collection with which to delete the document from.