Skip to content

Commit

Permalink
Matt's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Sep 12, 2024
1 parent dbe161f commit 5d66a90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,13 @@ See [runCommand behavior](#runcommand-behavior).
> [!NOTE]
> This portion of the specification is only relevant for drivers that provide `explain` helpers.
When `timeoutMS` is specified, drivers MUST take care to ensure that timeoutMS is correctly applied to the top-level
explain command. Care should be taken by drivers with a fluent API - the following example should apply a timeoutMS of
1000 to the `explain` command:
When `timeoutMS` is specified, drivers MUST provide a way to specify timeoutMS that results in maxTimeMS being set on
the `explain` command. For example, Node's implementation might look like:

```typescript
collection.find({}, { timeoutMS: 1000 }).explain();
collection.find({}).explain({ timeoutMS: 1000 });
// sends:
{ explain: { find: ... }, maxTimeMS: <remaining timeoutMS - min rtt>}
```

## Test Plan
Expand Down
2 changes: 1 addition & 1 deletion source/crud/crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@ collection.find({ name: 'john doe' }).explain({ timeoutMS: 1000 });
// sends:
{
explain: { find: <collection>, query: { name: 'john doe' } },
maxTimeMS: <1000 - average rtt>
maxTimeMS: <1000 - min rtt>
}
```
Expand Down

0 comments on commit 5d66a90

Please sign in to comment.