@@ -260,7 +260,7 @@ export class Db implements OperationParent {
260
260
options . readConcern = ReadConcern . fromOptions ( options ) ?? this . readConcern ;
261
261
262
262
return executeOperation (
263
- this . s . client . topology ,
263
+ this . topology ,
264
264
new CreateCollectionOperation ( this , name , options ) ,
265
265
callback
266
266
) ;
@@ -286,7 +286,7 @@ export class Db implements OperationParent {
286
286
options = options || { } ;
287
287
288
288
return executeOperation (
289
- this . s . client . topology ,
289
+ this . topology ,
290
290
new RunCommandOperation ( this , command , options ) ,
291
291
callback
292
292
) ;
@@ -311,9 +311,9 @@ export class Db implements OperationParent {
311
311
312
312
options = options || { } ;
313
313
314
- if ( ! this . s . client . topology ) throw new MongoClientClosedError ( 'Db.prototype.aggregate' ) ;
314
+ if ( ! this . topology ) throw new MongoClientClosedError ( 'Db.prototype.aggregate' ) ;
315
315
const cursor = new AggregationCursor (
316
- this . s . client . topology ,
316
+ this . topology ,
317
317
new AggregateOperation ( this , pipeline , options ) ,
318
318
options
319
319
) ;
@@ -377,7 +377,7 @@ export class Db implements OperationParent {
377
377
}
378
378
379
379
// Did the user destroy the topology
380
- if ( this . s . client . topology && this . s . client . topology . isDestroyed ( ) ) {
380
+ if ( this . topology && this . topology . isDestroyed ( ) ) {
381
381
return callback ( new MongoError ( 'topology was destroyed' ) ) ;
382
382
}
383
383
@@ -419,7 +419,7 @@ export class Db implements OperationParent {
419
419
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
420
420
options = options || { } ;
421
421
422
- return executeOperation ( this . s . client . topology , new DbStatsOperation ( this , options ) , callback ) ;
422
+ return executeOperation ( this . topology , new DbStatsOperation ( this , options ) , callback ) ;
423
423
}
424
424
425
425
/**
@@ -432,9 +432,9 @@ export class Db implements OperationParent {
432
432
filter = filter || { } ;
433
433
options = options || { } ;
434
434
435
- if ( ! this . s . client . topology ) throw new MongoClientClosedError ( 'Db.prototype.listCollections' ) ;
435
+ if ( ! this . topology ) throw new MongoClientClosedError ( 'Db.prototype.listCollections' ) ;
436
436
return new CommandCursor (
437
- this . s . client . topology ,
437
+ this . topology ,
438
438
new ListCollectionsOperation ( this , filter , options ) ,
439
439
options
440
440
) ;
@@ -478,7 +478,7 @@ export class Db implements OperationParent {
478
478
options . new_collection = true ;
479
479
480
480
return executeOperation (
481
- this . s . client . topology ,
481
+ this . topology ,
482
482
new RenameOperation ( this . collection ( fromCollection ) , toCollection , options ) ,
483
483
callback
484
484
) ;
@@ -504,7 +504,7 @@ export class Db implements OperationParent {
504
504
options = options || { } ;
505
505
506
506
return executeOperation (
507
- this . s . client . topology ,
507
+ this . topology ,
508
508
new DropCollectionOperation ( this , name , options ) ,
509
509
callback
510
510
) ;
@@ -527,11 +527,7 @@ export class Db implements OperationParent {
527
527
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
528
528
options = options || { } ;
529
529
530
- return executeOperation (
531
- this . s . client . topology ,
532
- new DropDatabaseOperation ( this , options ) ,
533
- callback
534
- ) ;
530
+ return executeOperation ( this . topology , new DropDatabaseOperation ( this , options ) , callback ) ;
535
531
}
536
532
537
533
/**
@@ -551,11 +547,7 @@ export class Db implements OperationParent {
551
547
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
552
548
options = options || { } ;
553
549
554
- return executeOperation (
555
- this . s . client . topology ,
556
- new CollectionsOperation ( this , options ) ,
557
- callback
558
- ) ;
550
+ return executeOperation ( this . topology , new CollectionsOperation ( this , options ) , callback ) ;
559
551
}
560
552
561
553
/**
@@ -582,7 +574,7 @@ export class Db implements OperationParent {
582
574
options = options || { } ;
583
575
584
576
return executeOperation (
585
- this . s . client . topology ,
577
+ this . topology ,
586
578
new RunAdminCommandOperation ( this , command , options ) ,
587
579
callback
588
580
) ;
@@ -619,7 +611,7 @@ export class Db implements OperationParent {
619
611
options = options ? Object . assign ( { } , options ) : { } ;
620
612
621
613
return executeOperation (
622
- this . s . client . topology ,
614
+ this . topology ,
623
615
new CreateIndexOperation ( this , name , indexSpec , options ) ,
624
616
callback
625
617
) ;
@@ -666,7 +658,7 @@ export class Db implements OperationParent {
666
658
667
659
options = options || { } ;
668
660
return executeOperation (
669
- this . s . client . topology ,
661
+ this . topology ,
670
662
new AddUserOperation ( this , username , password , options ) ,
671
663
callback
672
664
) ;
@@ -692,7 +684,7 @@ export class Db implements OperationParent {
692
684
options = options || { } ;
693
685
694
686
return executeOperation (
695
- this . s . client . topology ,
687
+ this . topology ,
696
688
new RemoveUserOperation ( this , username , options ) ,
697
689
callback
698
690
) ;
@@ -725,7 +717,7 @@ export class Db implements OperationParent {
725
717
options = options || { } ;
726
718
727
719
return executeOperation (
728
- this . s . client . topology ,
720
+ this . topology ,
729
721
new SetProfilingLevelOperation ( this , level , options ) ,
730
722
callback
731
723
) ;
@@ -748,11 +740,7 @@ export class Db implements OperationParent {
748
740
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
749
741
options = options || { } ;
750
742
751
- return executeOperation (
752
- this . s . client . topology ,
753
- new ProfilingLevelOperation ( this , options ) ,
754
- callback
755
- ) ;
743
+ return executeOperation ( this . topology , new ProfilingLevelOperation ( this , options ) , callback ) ;
756
744
}
757
745
758
746
/**
@@ -779,16 +767,16 @@ export class Db implements OperationParent {
779
767
options = options || { } ;
780
768
781
769
return executeOperation (
782
- this . s . client . topology ,
770
+ this . topology ,
783
771
new IndexInformationOperation ( this , name , options ) ,
784
772
callback
785
773
) ;
786
774
}
787
775
788
776
/** Unref all sockets */
789
777
unref ( ) : void {
790
- if ( this . s . client . topology ) {
791
- this . s . client . topology . unref ( ) ;
778
+ if ( this . topology ) {
779
+ this . topology . unref ( ) ;
792
780
}
793
781
}
794
782
@@ -852,7 +840,7 @@ export class Db implements OperationParent {
852
840
options = options || { } ;
853
841
854
842
return executeOperation (
855
- this . s . client . topology ,
843
+ this . topology ,
856
844
new EvalOperation ( this , code , parameters , options ) ,
857
845
callback
858
846
) ;
@@ -890,7 +878,7 @@ export class Db implements OperationParent {
890
878
options = options || { } ;
891
879
892
880
return executeOperation (
893
- this . s . client . topology ,
881
+ this . topology ,
894
882
new EnsureIndexOperation ( this , name , fieldOrSpec , options ) ,
895
883
callback
896
884
) ;
0 commit comments