Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-6408

Remove find + aggregate explain option support in favor of explain() on cursors

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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:
            bailey.pearson@mongodb.com Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: