Specifies whether MongoDB can use temporary disk files while processing a blocking sort operation. Raises :exc:`TypeError` if `allow_disk_use` is not a boolean. .. note:: `allow_disk_use` requires server version **>= 4.4** :param allow_disk_use: if True, MongoDB ma
(self, allow_disk_use: bool)
| 396 | return self |
| 397 | |
| 398 | def allow_disk_use(self, allow_disk_use: bool) -> Cursor[_DocumentType]: |
| 399 | """Specifies whether MongoDB can use temporary disk files while |
| 400 | processing a blocking sort operation. |
| 401 | |
| 402 | Raises :exc:`TypeError` if `allow_disk_use` is not a boolean. |
| 403 | |
| 404 | .. note:: `allow_disk_use` requires server version **>= 4.4** |
| 405 | |
| 406 | :param allow_disk_use: if True, MongoDB may use temporary |
| 407 | disk files to store data exceeding the system memory limit while |
| 408 | processing a blocking sort operation. |
| 409 | |
| 410 | .. versionadded:: 3.11 |
| 411 | """ |
| 412 | if not isinstance(allow_disk_use, bool): |
| 413 | raise TypeError(f"allow_disk_use must be a bool, not {type(allow_disk_use)}") |
| 414 | self._check_okay_to_chain() |
| 415 | |
| 416 | self._allow_disk_use = allow_disk_use |
| 417 | return self |
| 418 | |
| 419 | def limit(self, limit: int) -> Cursor[_DocumentType]: |
| 420 | """Limits the number of results to be returned by this cursor. |