[GODRIVER-2356] Add support for $explain Created: 23/Mar/22 Updated: 05/Apr/22 Resolved: 05/Apr/22 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | CRUD |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Peter Ivanov | Assignee: | Benji Rewis (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Documentation Changes: | Not Needed | ||||||||||||||||
| Description |
|
The essence of request is very simple: to add `explain` as a natively supported feature. Currently, the only way to do it seems to be to call a `Database.RunCommand()`, which requires manually constructing the query document. Primitives like `operation.NewFind()` do not expose enough to construct query document with it. As a result, not only does the use of `explain` require extra effort, it is prone to mistakes when the query being explained will end up being not the same query as you would execute using the normal driver API. Use cases that I know of include diagnostic tools and testing mechanisms that validate existing queries in regard of conforming with indexes and sharding. |
| Comments |
| Comment by Benji Rewis (Inactive) [ 05/Apr/22 ] |
|
Will wait for changes from DRIVERS-2252. |
| Comment by Benji Rewis (Inactive) [ 05/Apr/22 ] |
|
Just following up here, petr.ivanov.s@gmail.com: the associated drivers ticket DRIVERS-2252 has been backlogged for now. I'll close this GODRIVER ticket in favor of that one. |
| Comment by Benji Rewis (Inactive) [ 30/Mar/22 ] |
|
Thanks for your feature request, petr.ivanov.s@gmail.com! Indeed, we do not offer an explain helper or explain options for Find or Aggregate operations. As stated in our cross-drivers CRUD specification:
Implementing explain as you've described would require a cross-drivers change and a determination that this is a common enough use-case across drivers. I've opened DRIVERS-2252 (and linked it to this ticket) to reconsider explain support. |
| Comment by Esha Bhargava [ 25/Mar/22 ] |
|
petr.ivanov.s@gmail.com Thank you for reporting this issue. We'll look into it and get back to you soon. |