@@ -48,30 +48,30 @@ import {
48
48
onlyShardedCollectionsInConfigFilter ,
49
49
aggregateBackgroundOptionNotSupportedHelp ,
50
50
} from './helpers' ;
51
- import type {
52
- AnyBulkWriteOperation ,
53
- BulkWriteOptions ,
54
- CountOptions ,
55
- CountDocumentsOptions ,
56
- ChangeStreamOptions ,
57
- CreateIndexesOptions ,
58
- DeleteOptions ,
59
- DistinctOptions ,
60
- Document ,
61
- EstimatedDocumentCountOptions ,
62
- ExplainVerbosityLike ,
63
- FindOneAndDeleteOptions ,
64
- FindOneAndReplaceOptions ,
65
- FindOneAndUpdateOptions ,
66
- FindOptions ,
67
- InsertOneOptions ,
68
- ReplaceOptions ,
69
- RunCommandOptions ,
70
- UpdateOptions ,
71
- DropCollectionOptions ,
72
- CheckMetadataConsistencyOptions ,
73
- AggregateOptions ,
74
- SearchIndexDescription ,
51
+ import {
52
+ type AnyBulkWriteOperation ,
53
+ type BulkWriteOptions ,
54
+ type CountOptions ,
55
+ type CountDocumentsOptions ,
56
+ type ChangeStreamOptions ,
57
+ type CreateIndexesOptions ,
58
+ type DeleteOptions ,
59
+ type DistinctOptions ,
60
+ type Document ,
61
+ type EstimatedDocumentCountOptions ,
62
+ type ExplainVerbosityLike ,
63
+ type FindOneAndDeleteOptions ,
64
+ type FindOneAndReplaceOptions ,
65
+ type FindOneAndUpdateOptions ,
66
+ type FindOptions ,
67
+ type InsertOneOptions ,
68
+ type ReplaceOptions ,
69
+ type RunCommandOptions ,
70
+ type UpdateOptions ,
71
+ type DropCollectionOptions ,
72
+ type CheckMetadataConsistencyOptions ,
73
+ type AggregateOptions ,
74
+ type SearchIndexDescription ,
75
75
} from '@mongosh/service-provider-core' ;
76
76
import type { RunCommandCursor , Database , DatabaseWithSchema } from './index' ;
77
77
import {
@@ -2389,7 +2389,7 @@ export class Collection<
2389
2389
) : Promise < RunCommandCursor > {
2390
2390
this . _emitCollectionApiCall ( 'checkMetadataConsistency' , { options } ) ;
2391
2391
2392
- return this . _database . _runCursorCommand ( {
2392
+ return await this . _database . _runCursorCommand ( {
2393
2393
checkMetadataConsistency : this . _name ,
2394
2394
} ) ;
2395
2395
}
@@ -2531,7 +2531,11 @@ export class Collection<
2531
2531
2532
2532
async _getSampleDocs ( ) : Promise < Document [ ] > {
2533
2533
this . _cachedSampleDocs = await (
2534
- await this . aggregate ( [ { $sample : { size : 10 } } ] )
2534
+ await this . aggregate ( [ { $sample : { size : 10 } } ] , {
2535
+ allowDiskUse : true ,
2536
+ maxTimeMS : 1000 ,
2537
+ readPreference : 'secondaryPreferred' ,
2538
+ } )
2535
2539
) . toArray ( ) ;
2536
2540
return this . _cachedSampleDocs ;
2537
2541
}
0 commit comments