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

Remove all optional argument handling logic

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 5.0.0
    • Affects Version/s: None
    • Component/s: None

      How are you using Mongo? What version of the server and driver are you using?

      Maintaining APIs that automatically detect and reorganize arguments has a lot of overhead and we should remove all cases in v5.0 of the driver. It can become particularly challenging if a new argument has the same typeof an existing one.

      What is the feature/improvement you would like?

      Remove code like this:

      // addUser
      if (typeof password === 'function') {
            (callback = password), (password = undefined), (options = {});
          } else if (typeof password !== 'string') {
            if (typeof options === 'function') {
              (callback = options), (options = password), (password = undefined);
            } else {
              (options = password), (callback = undefined), (password = undefined);
            }
          } else {
            if (typeof options === 'function') (callback = options), (options = {});
          }
      

      What use case would this feature/improvement enable?

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: