File tree Expand file tree Collapse file tree 4 files changed +13
-0
lines changed Expand file tree Collapse file tree 4 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,10 @@ export class Collection<TSchema extends Document = Document> {
254
254
this . s . collectionHint = normalizeHintField ( v ) ;
255
255
}
256
256
257
+ get timeoutMS ( ) : number | undefined {
258
+ return this . s . options . timeoutMS ;
259
+ }
260
+
257
261
/**
258
262
* Inserts a single document into MongoDB. If documents passed in do not contain the **_id** field,
259
263
* one will be added to each of the documents missing it by the driver, mutating the document. This behavior
Original file line number Diff line number Diff line change @@ -222,6 +222,10 @@ export class Db {
222
222
return this . s . namespace . toString ( ) ;
223
223
}
224
224
225
+ get timeoutMS ( ) : number | undefined {
226
+ return this . s . options ?. timeoutMS ;
227
+ }
228
+
225
229
/**
226
230
* Create a new collection on a server with the specified options. Use this to create capped collections.
227
231
* More information about command options available at https://www.mongodb.com/docs/manual/reference/command/create/
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ export interface OperationParent {
64
64
writeConcern ?: WriteConcern ;
65
65
readPreference ?: ReadPreference ;
66
66
bsonOptions ?: BSONSerializeOptions ;
67
+ timeoutMS ?: number ;
67
68
}
68
69
69
70
/** @internal */
Original file line number Diff line number Diff line change @@ -514,6 +514,10 @@ export function resolveOptions<T extends CommandOperationOptions>(
514
514
result . readPreference = readPreference ;
515
515
}
516
516
517
+ const timeoutMS = options ?. timeoutMS ;
518
+
519
+ result . timeoutMS = timeoutMS ?? parent ?. timeoutMS ;
520
+
517
521
return result ;
518
522
}
519
523
You can’t perform that action at this time.
0 commit comments