'Finds a single document and deletes it, returning the document.
>>> db.test.count({\'x\': 1})
2
>>> db.test.find_one_and_delete({\'x\': 1})
{u\'x\': 1, u\'_id\': ObjectId(\'54f4e12bfba5220aa4d6dee8\')}
>>> db.test.count({\'x\': 1})
1
If multiple documents match *filter*, a *sort* can be applied.
>>> for doc in db.test.find({\'x\': 1}):
...     print(doc)
{u\'x\': 1, u\'_id\': 0}
{u\'x\': 1, u\'_id\': 1}
{u\'x\': 1, u\'_id\': 2}
>>> db.test.find_one_and_delete(
...     {\'x\': 1}, sort=[(\'_id\', pymongo.DESCENDING)])
{u\'x\': 1, u\'_id\': 2}
The *projection* option can be used to limit the fields returned.
>>> db.test.find_one_and_delete({\'x\': 1}, projection={\'_id\': False})
{u\'x\': 1}
:Parameters:
- `filter`: A query that matches the document to delete.
- `projection` (optional): a list of field names that should be
returned in the result document or a mapping specifying the fields
to include or exclude. If `projection` is a list "_id" will
always be returned. Use a mapping to exclude fields from
the result (e.g. projection={\'_id\': False}).
- `sort` (optional): a list of (key, direction) pairs
specifying the sort order for the query. If multiple documents
match the query, they are sorted and the first is deleted.
- `**kwargs` (optional): additional command arguments can be passed
as keyword arguments (for example maxTimeMS can be used with
recent server versions).
.. versionchanged:: 3.2
Respects write concern.
.. warning:: Starting in PyMongo 3.2, this command uses the
:class:`~pymongo.write_concern.WriteConcern` of this
:class:`~pymongo.collection.Collection` when connected to MongoDB >=
3.2. Note that using an elevated write concern with this command may
be slower compared to using the default write concern.
.. versionchanged:: 3.4
Added the `collation` option.
.. versionadded:: 3.0'

def find_one_and_delete(self, filter, projection=None, sort=None, **kwargs):

    kwargs['remove'] = True
    return self.__find_and_modify(filter, projection, sort, **kwargs)
