Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-3631

Support :verbosity option when explaining an aggregation command

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.21.0
    • Component/s: CRUD, Query
    • None
    • None
    • Ruby Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Problem Summary

      Running `explain` on an aggregation command does not support specifying `:verbosity` (e.g. 'queryPlanner', 'executionStats', or 'allPlansExecution').

      Proposal

      Let's update the `Aggregation::Behavior#explain` method so that if it is given a verbosity option, it switches to use the `explain` command, instead of using the `explain` option in the `aggregate` command.

      Problem Description

      The `Aggregation::Behavior` module overrides the `#explain` method so that it only sets `explain: true`, and does not accept any options. This is because we are using the `explain` option in the aggregate command itself, which must be a boolean and does not support any verbosity options. (See https://www.mongodb.com/docs/manual/reference/command/aggregate/#syntax).

      This is unfortunate because the `#explain` method on collections does support the verbosity options. This results in confusion when a user expects the API to work consistently across both views (collection and aggregation).

      The collection `#explain` method uses the `explain` command: (https://www.mongodb.com/docs/manual/reference/command/explain/).

            Assignee:
            Unassigned Unassigned
            Reporter:
            jamis.buck@mongodb.com Jamis Buck
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None