|
35 | 35 | TypeVar,
|
36 | 36 | Union,
|
37 | 37 | cast,
|
| 38 | + overload, |
38 | 39 | )
|
39 | 40 |
|
40 | 41 | from bson.codec_options import DEFAULT_CODEC_OPTIONS, CodecOptions
|
@@ -332,13 +333,33 @@ def database(self) -> AsyncDatabase[_DocumentType]:
|
332 | 333 | """
|
333 | 334 | return self._database
|
334 | 335 |
|
| 336 | + @overload |
| 337 | + def with_options( |
| 338 | + self, |
| 339 | + codec_options: None = None, |
| 340 | + read_preference: Optional[_ServerMode] = ..., |
| 341 | + write_concern: Optional[WriteConcern] = ..., |
| 342 | + read_concern: Optional[ReadConcern] = ..., |
| 343 | + ) -> AsyncCollection[_DocumentType]: |
| 344 | + ... |
| 345 | + |
| 346 | + @overload |
| 347 | + def with_options( |
| 348 | + self, |
| 349 | + codec_options: bson.CodecOptions[_DocumentTypeArg], |
| 350 | + read_preference: Optional[_ServerMode] = ..., |
| 351 | + write_concern: Optional[WriteConcern] = ..., |
| 352 | + read_concern: Optional[ReadConcern] = ..., |
| 353 | + ) -> AsyncCollection[_DocumentTypeArg]: |
| 354 | + ... |
| 355 | + |
335 | 356 | def with_options(
|
336 | 357 | self,
|
337 | 358 | codec_options: Optional[bson.CodecOptions[_DocumentTypeArg]] = None,
|
338 | 359 | read_preference: Optional[_ServerMode] = None,
|
339 | 360 | write_concern: Optional[WriteConcern] = None,
|
340 | 361 | read_concern: Optional[ReadConcern] = None,
|
341 |
| - ) -> AsyncCollection[_DocumentType]: |
| 362 | + ) -> AsyncCollection[_DocumentType] | AsyncCollection[_DocumentTypeArg]: |
342 | 363 | """Get a clone of this collection changing the specified settings.
|
343 | 364 |
|
344 | 365 | >>> coll1.read_preference
|
|
0 commit comments