File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
client-side-operations-timeout Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,16 @@ check the command document for the presence of a `maxTimeMS` field.
427427
428428See [ runCommand behavior] ( #runcommand-behavior ) .
429429
430+ ### Explain Helpers
431+
432+ If a driver provides an explain helper, drivers MUST take care to ensure that timeoutMS is correctly applied to the top-level
433+ explain command, when specified. Care should be taken by drivers with a fluent API - the following example
434+ should apply a timeoutMS of 1000 to the ` explain ` command:
435+
436+ ``` typescript
437+ collection .find ({}, { timeoutMS: 1000 }).explain ();
438+ ```
439+
430440## Test Plan
431441
432442See the [ README.rst] ( tests/README.md ) in the tests directory.
Original file line number Diff line number Diff line change @@ -2198,6 +2198,24 @@ the [$readPreference global command argument](../message/OP_MSG.md#global-comman
21982198[ passing read preference to mongos and load balancers] ( ../server-selection/server-selection.md#passing-read-preference-to-mongos-and-load-balancers )
21992199(if applicable).
22002200
2201+
2202+ ### Explain
2203+
2204+ Some drivers provide explain helpers. If a driver does provide explain helpers, the driver MUST ensure that its helper permits users to
2205+ specify options for the explain command specifically. An example, using Node, might look like:
2206+
2207+ ``` typescript
2208+ collection .find ({ name: ' john doe' }).explain ({ maxTimeMS: 1000 });
2209+
2210+ // sends:
2211+ {
2212+ explain : { find : <collection >, query : { name : ' john doe' } },
2213+ maxTimeMS : 1000
2214+ }
2215+ ```
2216+
2217+ Drivers MUST document how users can specify options on their explain helpers.
2218+
22012219## Test Plan
22022220
22032221See the [ README] ( tests/README.md ) for tests.
Original file line number Diff line number Diff line change @@ -676,3 +676,14 @@ InsertOne {
676676
677677Execute ` bulkWrite ` on ` client ` with ` model ` . Assert that an error (referred to as ` error ` ) is returned. Assert that
678678` error ` is a client error containing the message: "bulkWrite does not currently support automatic encryption".
679+
680+ ### 14. ` explain ` helpers allow users to specify ` maxTimeMS `
681+
682+ Create a MongoClient with command monitoring enabled (referred to as ` client ` ).
683+
684+ Create a collection, referred to as ` collection ` , with the namespace ` explain-test.collection ` .
685+
686+ Run an explained find on ` collection ` . The find will have the query predicate ` { name: 'john doe' } ` . Specify
687+ a maxTimeMS value of 2000ms for the ` explain ` .
688+
689+ Obtain the command started event for the explain. Confirm that the top-level explain command should has a ` maxTimeMS ` value of ` 2000 ` .
You can’t perform that action at this time.
0 commit comments