@@ -313,7 +313,6 @@ export class Collection implements OperationParent {
313
313
options . ignoreUndefined = this . s . options . ignoreUndefined ;
314
314
}
315
315
316
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
317
316
return executeOperation (
318
317
this . s . db . topology ,
319
318
new InsertOneOperation ( this , doc , options ) ,
@@ -346,7 +345,6 @@ export class Collection implements OperationParent {
346
345
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
347
346
options = options ? Object . assign ( { } , options ) : { ordered : true } ;
348
347
349
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
350
348
return executeOperation (
351
349
this . s . db . topology ,
352
350
new InsertManyOperation ( this , docs , options ) ,
@@ -407,7 +405,6 @@ export class Collection implements OperationParent {
407
405
throw new MongoError ( 'operations must be an array of documents' ) ;
408
406
}
409
407
410
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
411
408
return executeOperation (
412
409
this . s . db . topology ,
413
410
new BulkWriteOperation ( this , operations , options ) ,
@@ -447,7 +444,6 @@ export class Collection implements OperationParent {
447
444
options . ignoreUndefined = this . s . options . ignoreUndefined ;
448
445
}
449
446
450
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
451
447
return executeOperation (
452
448
this . s . db . topology ,
453
449
new UpdateOneOperation ( this , filter , update , options ) ,
@@ -491,7 +487,6 @@ export class Collection implements OperationParent {
491
487
options . ignoreUndefined = this . s . options . ignoreUndefined ;
492
488
}
493
489
494
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
495
490
return executeOperation (
496
491
this . s . db . topology ,
497
492
new ReplaceOneOperation ( this , filter , replacement , options ) ,
@@ -531,7 +526,6 @@ export class Collection implements OperationParent {
531
526
options . ignoreUndefined = this . s . options . ignoreUndefined ;
532
527
}
533
528
534
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
535
529
return executeOperation (
536
530
this . s . db . topology ,
537
531
new UpdateManyOperation ( this , filter , update , options ) ,
@@ -564,7 +558,6 @@ export class Collection implements OperationParent {
564
558
options . ignoreUndefined = this . s . options . ignoreUndefined ;
565
559
}
566
560
567
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
568
561
return executeOperation (
569
562
this . s . db . topology ,
570
563
new DeleteOneOperation ( this , filter , options ) ,
@@ -609,7 +602,6 @@ export class Collection implements OperationParent {
609
602
options . ignoreUndefined = this . s . options . ignoreUndefined ;
610
603
}
611
604
612
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
613
605
return executeOperation (
614
606
this . s . db . topology ,
615
607
new DeleteManyOperation ( this , filter , options ) ,
@@ -636,7 +628,6 @@ export class Collection implements OperationParent {
636
628
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
637
629
options = Object . assign ( { } , options , { readPreference : ReadPreference . PRIMARY } ) ;
638
630
639
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
640
631
return executeOperation (
641
632
this . s . db . topology ,
642
633
new RenameOperation ( this , newName , options ) ,
@@ -661,7 +652,6 @@ export class Collection implements OperationParent {
661
652
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
662
653
options = options || { } ;
663
654
664
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
665
655
return executeOperation (
666
656
this . s . db . topology ,
667
657
new DropCollectionOperation ( this . s . db , this . collectionName , options ) ,
@@ -697,7 +687,6 @@ export class Collection implements OperationParent {
697
687
query = query || { } ;
698
688
options = options || { } ;
699
689
700
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
701
690
return executeOperation (
702
691
this . s . db . topology ,
703
692
new FindOneOperation ( this , query , options ) ,
@@ -746,7 +735,6 @@ export class Collection implements OperationParent {
746
735
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
747
736
options = options || { } ;
748
737
749
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
750
738
return executeOperation ( this . s . db . topology , new OptionsOperation ( this , options ) , callback ) ;
751
739
}
752
740
@@ -767,7 +755,6 @@ export class Collection implements OperationParent {
767
755
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
768
756
options = options || { } ;
769
757
770
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
771
758
return executeOperation ( this . s . db . topology , new IsCappedOperation ( this , options ) , callback ) ;
772
759
}
773
760
@@ -816,7 +803,6 @@ export class Collection implements OperationParent {
816
803
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
817
804
options = options || { } ;
818
805
819
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
820
806
return executeOperation (
821
807
this . s . db . topology ,
822
808
new CreateIndexOperation ( this , this . collectionName , indexSpec , options ) ,
@@ -873,7 +859,6 @@ export class Collection implements OperationParent {
873
859
options = options ? Object . assign ( { } , options ) : { } ;
874
860
if ( typeof options . maxTimeMS !== 'number' ) delete options . maxTimeMS ;
875
861
876
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
877
862
return executeOperation (
878
863
this . s . db . topology ,
879
864
new CreateIndexesOperation ( this , this . collectionName , indexSpecs , options ) ,
@@ -903,7 +888,6 @@ export class Collection implements OperationParent {
903
888
// Run only against primary
904
889
options . readPreference = ReadPreference . primary ;
905
890
906
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
907
891
return executeOperation (
908
892
this . s . db . topology ,
909
893
new DropIndexOperation ( this , indexName , options ) ,
@@ -928,7 +912,6 @@ export class Collection implements OperationParent {
928
912
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
929
913
options = options ? Object . assign ( { } , options ) : { } ;
930
914
931
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
932
915
return executeOperation ( this . s . db . topology , new DropIndexesOperation ( this , options ) , callback ) ;
933
916
}
934
917
@@ -971,7 +954,6 @@ export class Collection implements OperationParent {
971
954
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
972
955
options = options || { } ;
973
956
974
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
975
957
return executeOperation (
976
958
this . s . db . topology ,
977
959
new IndexExistsOperation ( this , indexes , options ) ,
@@ -996,7 +978,6 @@ export class Collection implements OperationParent {
996
978
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
997
979
options = options || { } ;
998
980
999
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1000
981
return executeOperation (
1001
982
this . s . db . topology ,
1002
983
new IndexInformationOperation ( this . s . db , this . collectionName , options ) ,
@@ -1021,7 +1002,6 @@ export class Collection implements OperationParent {
1021
1002
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1022
1003
options = options || { } ;
1023
1004
1024
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1025
1005
return executeOperation (
1026
1006
this . s . db . topology ,
1027
1007
new EstimatedDocumentCountOperation ( this , options ) ,
@@ -1078,8 +1058,6 @@ export class Collection implements OperationParent {
1078
1058
1079
1059
query = query || { } ;
1080
1060
options = options || { } ;
1081
-
1082
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1083
1061
return executeOperation (
1084
1062
this . s . db . topology ,
1085
1063
new CountDocumentsOperation ( this , query as Document , options as CountDocumentsOptions ) ,
@@ -1122,8 +1100,6 @@ export class Collection implements OperationParent {
1122
1100
1123
1101
query = query || { } ;
1124
1102
options = options || { } ;
1125
-
1126
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1127
1103
return executeOperation (
1128
1104
this . s . db . topology ,
1129
1105
new DistinctOperation ( this , key , query as Document , options as DistinctOptions ) ,
@@ -1148,7 +1124,6 @@ export class Collection implements OperationParent {
1148
1124
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1149
1125
options = options || { } ;
1150
1126
1151
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1152
1127
return executeOperation ( this . s . db . topology , new IndexesOperation ( this , options ) , callback ) ;
1153
1128
}
1154
1129
@@ -1169,7 +1144,6 @@ export class Collection implements OperationParent {
1169
1144
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1170
1145
options = options || { } ;
1171
1146
1172
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1173
1147
return executeOperation ( this . s . db . topology , new CollStatsOperation ( this , options ) , callback ) ;
1174
1148
}
1175
1149
@@ -1196,7 +1170,6 @@ export class Collection implements OperationParent {
1196
1170
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1197
1171
options = options || { } ;
1198
1172
1199
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1200
1173
return executeOperation (
1201
1174
this . s . db . topology ,
1202
1175
new FindOneAndDeleteOperation ( this , filter , options ) ,
@@ -1234,7 +1207,6 @@ export class Collection implements OperationParent {
1234
1207
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1235
1208
options = options || { } ;
1236
1209
1237
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1238
1210
return executeOperation (
1239
1211
this . s . db . topology ,
1240
1212
new FindOneAndReplaceOperation ( this , filter , replacement , options ) ,
@@ -1272,7 +1244,6 @@ export class Collection implements OperationParent {
1272
1244
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1273
1245
options = options || { } ;
1274
1246
1275
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1276
1247
return executeOperation (
1277
1248
this . s . db . topology ,
1278
1249
new FindOneAndUpdateOperation ( this , filter , update , options ) ,
@@ -1383,7 +1354,6 @@ export class Collection implements OperationParent {
1383
1354
options . finalize = options . finalize . toString ( ) ;
1384
1355
}
1385
1356
1386
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1387
1357
return executeOperation (
1388
1358
this . s . db . topology ,
1389
1359
new MapReduceOperation ( this , map , reduce , options ) ,
@@ -1516,7 +1486,6 @@ export class Collection implements OperationParent {
1516
1486
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1517
1487
options = options || { } ;
1518
1488
1519
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1520
1489
return executeOperation (
1521
1490
this . s . db . topology ,
1522
1491
new EnsureIndexOperation ( this . s . db , this . collectionName , fieldOrSpec , options ) ,
@@ -1556,8 +1525,6 @@ export class Collection implements OperationParent {
1556
1525
1557
1526
query = query || { } ;
1558
1527
options = options || { } ;
1559
-
1560
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1561
1528
return executeOperation (
1562
1529
this . s . db . topology ,
1563
1530
new EstimatedDocumentCountOperation ( this , query , options ) ,
@@ -1607,7 +1574,6 @@ export class Collection implements OperationParent {
1607
1574
// Add the remove option
1608
1575
options . remove = true ;
1609
1576
1610
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1611
1577
return executeOperation (
1612
1578
this . s . db . topology ,
1613
1579
new FindAndModifyOperation ( this , query , sort as Sort , undefined , options ) ,
@@ -1668,7 +1634,6 @@ export class Collection implements OperationParent {
1668
1634
// Set up the command as default
1669
1635
command = command == null ? true : command ;
1670
1636
1671
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1672
1637
if ( command == null ) {
1673
1638
return executeOperation (
1674
1639
this . s . db . topology ,
@@ -1728,7 +1693,6 @@ export class Collection implements OperationParent {
1728
1693
// Force read preference primary
1729
1694
options . readPreference = ReadPreference . primary ;
1730
1695
1731
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1732
1696
return executeOperation (
1733
1697
this . s . db . topology ,
1734
1698
new FindAndModifyOperation ( this , query , sort , doc , options ) ,
0 commit comments