Adds a :class:`~pymongo.collation.Collation` to this query. Raises :exc:`TypeError` if `collation` is not an instance of :class:`~pymongo.collation.Collation` or a ``dict``. Raises :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor` has already been used.
(self, collation: Optional[_CollationIn])
| 846 | return self |
| 847 | |
| 848 | def collation(self, collation: Optional[_CollationIn]) -> Cursor[_DocumentType]: |
| 849 | """Adds a :class:`~pymongo.collation.Collation` to this query. |
| 850 | |
| 851 | Raises :exc:`TypeError` if `collation` is not an instance of |
| 852 | :class:`~pymongo.collation.Collation` or a ``dict``. Raises |
| 853 | :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor` has |
| 854 | already been used. Only the last collation applied to this cursor has |
| 855 | any effect. |
| 856 | |
| 857 | :param collation: An instance of :class:`~pymongo.collation.Collation`. |
| 858 | """ |
| 859 | self._check_okay_to_chain() |
| 860 | self._collation = validate_collation_or_none(collation) |
| 861 | return self |
| 862 | |
| 863 | def _unpack_response( |
| 864 | self, |