@@ -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 ) ,
@@ -1079,7 +1059,6 @@ export class Collection implements OperationParent {
1079
1059
query = query || { } ;
1080
1060
options = options || { } ;
1081
1061
1082
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1083
1062
return executeOperation (
1084
1063
this . s . db . topology ,
1085
1064
new CountDocumentsOperation ( this , query as Document , options as CountDocumentsOptions ) ,
@@ -1123,7 +1102,6 @@ export class Collection implements OperationParent {
1123
1102
query = query || { } ;
1124
1103
options = options || { } ;
1125
1104
1126
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1127
1105
return executeOperation (
1128
1106
this . s . db . topology ,
1129
1107
new DistinctOperation ( this , key , query as Document , options as DistinctOptions ) ,
@@ -1148,7 +1126,6 @@ export class Collection implements OperationParent {
1148
1126
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1149
1127
options = options || { } ;
1150
1128
1151
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1152
1129
return executeOperation ( this . s . db . topology , new IndexesOperation ( this , options ) , callback ) ;
1153
1130
}
1154
1131
@@ -1169,7 +1146,6 @@ export class Collection implements OperationParent {
1169
1146
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1170
1147
options = options || { } ;
1171
1148
1172
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1173
1149
return executeOperation ( this . s . db . topology , new CollStatsOperation ( this , options ) , callback ) ;
1174
1150
}
1175
1151
@@ -1196,7 +1172,6 @@ export class Collection implements OperationParent {
1196
1172
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1197
1173
options = options || { } ;
1198
1174
1199
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1200
1175
return executeOperation (
1201
1176
this . s . db . topology ,
1202
1177
new FindOneAndDeleteOperation ( this , filter , options ) ,
@@ -1234,7 +1209,6 @@ export class Collection implements OperationParent {
1234
1209
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1235
1210
options = options || { } ;
1236
1211
1237
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1238
1212
return executeOperation (
1239
1213
this . s . db . topology ,
1240
1214
new FindOneAndReplaceOperation ( this , filter , replacement , options ) ,
@@ -1272,7 +1246,6 @@ export class Collection implements OperationParent {
1272
1246
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1273
1247
options = options || { } ;
1274
1248
1275
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1276
1249
return executeOperation (
1277
1250
this . s . db . topology ,
1278
1251
new FindOneAndUpdateOperation ( this , filter , update , options ) ,
@@ -1383,7 +1356,6 @@ export class Collection implements OperationParent {
1383
1356
options . finalize = options . finalize . toString ( ) ;
1384
1357
}
1385
1358
1386
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1387
1359
return executeOperation (
1388
1360
this . s . db . topology ,
1389
1361
new MapReduceOperation ( this , map , reduce , options ) ,
@@ -1516,7 +1488,6 @@ export class Collection implements OperationParent {
1516
1488
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
1517
1489
options = options || { } ;
1518
1490
1519
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1520
1491
return executeOperation (
1521
1492
this . s . db . topology ,
1522
1493
new EnsureIndexOperation ( this . s . db , this . collectionName , fieldOrSpec , options ) ,
@@ -1557,7 +1528,6 @@ export class Collection implements OperationParent {
1557
1528
query = query || { } ;
1558
1529
options = options || { } ;
1559
1530
1560
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1561
1531
return executeOperation (
1562
1532
this . s . db . topology ,
1563
1533
new EstimatedDocumentCountOperation ( this , query , options ) ,
@@ -1607,7 +1577,6 @@ export class Collection implements OperationParent {
1607
1577
// Add the remove option
1608
1578
options . remove = true ;
1609
1579
1610
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1611
1580
return executeOperation (
1612
1581
this . s . db . topology ,
1613
1582
new FindAndModifyOperation ( this , query , sort as Sort , undefined , options ) ,
@@ -1668,7 +1637,6 @@ export class Collection implements OperationParent {
1668
1637
// Set up the command as default
1669
1638
command = command == null ? true : command ;
1670
1639
1671
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1672
1640
if ( command == null ) {
1673
1641
return executeOperation (
1674
1642
this . s . db . topology ,
@@ -1728,7 +1696,6 @@ export class Collection implements OperationParent {
1728
1696
// Force read preference primary
1729
1697
options . readPreference = ReadPreference . primary ;
1730
1698
1731
- if ( ! this . s . db . topology ) throw new MongoClientClosedError ( ) ;
1732
1699
return executeOperation (
1733
1700
this . s . db . topology ,
1734
1701
new FindAndModifyOperation ( this , query , sort , doc , options ) ,
0 commit comments