(self, filter, collation=None)
Delete a single document matching the filter.

          >>> db.test.count({'x': 1})
          3
          >>> result = db.test.delete_one({'x': 1})
          >>> result.deleted_count
          1
          >>> db.test.count({'x': 1})
          2

        :Parameters:
          - `filter`: A query that matches the document to delete.
          - `collation` (optional): An instance of
            :class:`~pymongo.collation.Collation`. This option is only supported
            on MongoDB 3.4 and above.

        :Returns:
          - An instance of :class:`~pymongo.results.DeleteResult`.

        .. versionchanged:: 3.4
          Added the `collation` option.

        .. versionadded:: 3.0
Delete a single document matching the filter.
Delete a single document matching the filter .
def delete_one(self, filter, collation=None):
        """Delete a single document matching the filter.

          >>> db.test.count({'x': 1})
          3
          >>> result = db.test.delete_one({'x': 1})
          >>> result.deleted_count
          1
          >>> db.test.count({'x': 1})
          2

        :Parameters:
          - `filter`: A query that matches the document to delete.
          - `collation` (optional): An instance of
            :class:`~pymongo.collation.Collation`. This option is only supported
            on MongoDB 3.4 and above.

        :Returns:
          - An instance of :class:`~pymongo.results.DeleteResult`.

        .. versionchanged:: 3.4
          Added the `collation` option.

        .. versionadded:: 3.0
        """
        with self._socket_for_writes() as sock_info:
            return DeleteResult(self._delete(sock_info, filter, False,
                                             collation=collation),
                                self.write_concern.acknowledged)
def delete_one ( self , filter , collation = None ) : with self . _socket_for_writes ( ) as sock_info : return DeleteResult ( self . _delete ( sock_info , filter , False , collation = collation ) , self . write_concern . acknowledged )