Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1912

Investigate changes in NODE-6408: Remove find + aggregate explain option support in favor of explain() on cursors

    • Type: Icon: Investigation Investigation
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • 3

      Use Case

      We support the following explain APIs for cursors:

      collection.find().explain();
      collection.aggregate().explain();
      
      collection.find({}, { explain: ... }))
      collection.aggregate({}, { explain: ... }))
      

      The latter two are strange - `find` and `aggregate` always return cursors, even when explain is specified. As a result, to use these APIs, you must iterate the cursor:

      const [explainResult] = collection.find({}, { explain: ... })).toArray();
      // or
      const explainResult = collection.find({}, { explain: ... })).next();
      

      This API requires special workarounds in our cursors but provides little value. We should drop support for this API.

      These APIs will be removed in favor of:

      collection.find().explain();
      collection.aggregate().explain();
      

      User Experience

      • What is the desired/expected outcome for the user once this ticket is implemented?
      • If bug: What is the number of impacted customers? How severe is the impact? Is anyone blocked or broken?

      Dependencies

      • upstream and/or downstream requirements and timelines to bear in mind

      Risks/Unknowns

      • What could go wrong while implementing this change? (e.g., performance, inadvertent behavioral changes in adjacent functionality, existing tech debt, etc)
      • Is there an opportunity for better cross-driver alignment or testing in this area?
      • Is there an opportunity to improve existing documentation on this subject?

      Acceptance Criteria

      Implementation Requirements

      • functional reqs, potential snafus to avoid, performance targets, etc

      Testing Requirements

      • unit test, spec test sync, etc

      Documentation Requirements

      • DOCSP ticket, API docs, etc

      Follow Up Requirements

      • additional tickets to file, required releases, etc
      • if node behavior differs/will differ from other drivers, confirm with dbx devs what standard to aim for and what plan, if any, exists to reconcile the diverging behavior moving forward

            Assignee:
            Unassigned Unassigned
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: