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> {
254254 this . s . collectionHint = normalizeHintField ( v ) ;
255255 }
256256
257+ get timeoutMS ( ) : number | undefined {
258+ return this . s . options . timeoutMS ;
259+ }
260+
257261 /**
258262 * Inserts a single document into MongoDB. If documents passed in do not contain the **_id** field,
259263 * 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 {
222222 return this . s . namespace . toString ( ) ;
223223 }
224224
225+ get timeoutMS ( ) : number | undefined {
226+ return this . s . options ?. timeoutMS ;
227+ }
228+
225229 /**
226230 * Create a new collection on a server with the specified options. Use this to create capped collections.
227231 * 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 {
6464 writeConcern ?: WriteConcern ;
6565 readPreference ?: ReadPreference ;
6666 bsonOptions ?: BSONSerializeOptions ;
67+ timeoutMS ?: number ;
6768}
6869
6970/** @internal */
Original file line number Diff line number Diff line change @@ -514,6 +514,10 @@ export function resolveOptions<T extends CommandOperationOptions>(
514514 result . readPreference = readPreference ;
515515 }
516516
517+ const timeoutMS = options ?. timeoutMS ;
518+
519+ result . timeoutMS = timeoutMS ?? parent ?. timeoutMS ;
520+
517521 return result ;
518522}
519523
You can’t perform that action at this time.
0 commit comments