Delete one or more documents matching the filter.

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

        :Parameters:
          - `filter`: A query that matches the documents 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

def delete_many(self, filter, collation=None):
        """Delete one or more documents matching the filter.

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

        :Parameters:
          - `filter`: A query that matches the documents 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, True,
                                             collation=collation),
                                self.write_concern.acknowledged)