@@ -376,6 +376,7 @@ def __init__(
376
376
else :
377
377
self ._hint = hint
378
378
379
+ self ._sort = sort
379
380
self ._filter = filter
380
381
self ._doc = replacement
381
382
self ._upsert = upsert
@@ -390,6 +391,7 @@ def _add_to_bulk(self, bulkobj: _AgnosticBulk) -> None:
390
391
self ._upsert ,
391
392
collation = validate_collation_or_none (self ._collation ),
392
393
hint = self ._hint ,
394
+ sort = self ._sort ,
393
395
)
394
396
395
397
def _add_to_client_bulk (self , bulkobj : _AgnosticClientBulk ) -> None :
@@ -405,6 +407,7 @@ def _add_to_client_bulk(self, bulkobj: _AgnosticClientBulk) -> None:
405
407
self ._upsert ,
406
408
collation = validate_collation_or_none (self ._collation ),
407
409
hint = self ._hint ,
410
+ sort = self ._sort ,
408
411
)
409
412
410
413
def __eq__ (self , other : Any ) -> bool :
@@ -416,13 +419,15 @@ def __eq__(self, other: Any) -> bool:
416
419
other ._collation ,
417
420
other ._hint ,
418
421
other ._namespace ,
422
+ other ._sort ,
419
423
) == (
420
424
self ._filter ,
421
425
self ._doc ,
422
426
self ._upsert ,
423
427
self ._collation ,
424
- other ._hint ,
428
+ self ._hint ,
425
429
self ._namespace ,
430
+ self ._sort ,
426
431
)
427
432
return NotImplemented
428
433
@@ -431,22 +436,24 @@ def __ne__(self, other: Any) -> bool:
431
436
432
437
def __repr__ (self ) -> str :
433
438
if self ._namespace :
434
- return "{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r})" .format (
439
+ return "{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r} )" .format (
435
440
self .__class__ .__name__ ,
436
441
self ._filter ,
437
442
self ._doc ,
438
443
self ._upsert ,
439
444
self ._collation ,
440
445
self ._hint ,
441
446
self ._namespace ,
447
+ self ._sort ,
442
448
)
443
- return "{}({!r}, {!r}, {!r}, {!r}, {!r})" .format (
449
+ return "{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r} )" .format (
444
450
self .__class__ .__name__ ,
445
451
self ._filter ,
446
452
self ._doc ,
447
453
self ._upsert ,
448
454
self ._collation ,
449
455
self ._hint ,
456
+ self ._sort ,
450
457
)
451
458
452
459
@@ -485,15 +492,13 @@ def __init__(
485
492
self ._hint : Union [str , dict [str , Any ], None ] = helpers_shared ._index_document (hint )
486
493
else :
487
494
self ._hint = hint
488
- if sort is not None :
489
- self ._sort = sort
490
-
491
495
self ._filter = filter
492
496
self ._doc = doc
493
497
self ._upsert = upsert
494
498
self ._collation = collation
495
499
self ._array_filters = array_filters
496
500
self ._namespace = namespace
501
+ self ._sort = sort
497
502
498
503
def __eq__ (self , other : object ) -> bool :
499
504
if isinstance (other , type (self )):
@@ -505,6 +510,7 @@ def __eq__(self, other: object) -> bool:
505
510
other ._array_filters ,
506
511
other ._hint ,
507
512
other ._namespace ,
513
+ other ._sort ,
508
514
) == (
509
515
self ._filter ,
510
516
self ._doc ,
@@ -513,6 +519,7 @@ def __eq__(self, other: object) -> bool:
513
519
self ._array_filters ,
514
520
self ._hint ,
515
521
self ._namespace ,
522
+ self ._sort ,
516
523
)
517
524
return NotImplemented
518
525
@@ -529,8 +536,8 @@ def __repr__(self) -> str:
529
536
self ._collation ,
530
537
self ._array_filters ,
531
538
self ._hint ,
532
- self ._sort ,
533
539
self ._namespace ,
540
+ self ._sort ,
534
541
)
535
542
return "{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r})" .format (
536
543
self .__class__ .__name__ ,
@@ -608,6 +615,7 @@ def _add_to_bulk(self, bulkobj: _AgnosticBulk) -> None:
608
615
collation = validate_collation_or_none (self ._collation ),
609
616
array_filters = self ._array_filters ,
610
617
hint = self ._hint ,
618
+ sort = self ._sort ,
611
619
)
612
620
613
621
def _add_to_client_bulk (self , bulkobj : _AgnosticClientBulk ) -> None :
@@ -625,6 +633,7 @@ def _add_to_client_bulk(self, bulkobj: _AgnosticClientBulk) -> None:
625
633
collation = validate_collation_or_none (self ._collation ),
626
634
array_filters = self ._array_filters ,
627
635
hint = self ._hint ,
636
+ sort = self ._sort ,
628
637
)
629
638
630
639
0 commit comments