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

Cursor.count() - Wrong default value for applySkipLimit when used with promises

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.4.1
    • Component/s: None
    • None
    • Not Needed
    • Not Needed

      Hi after some tests and review code.

      I figured out that default value for applySkipLimit is false when using with Promise.

      applySkipLimit is set to true only if the given parameter is a function.
      If no parameter is provided (no callback, returning Promise) applySkipLimit is equal to undefined which is a falsy value.

      // file lib/cursor.js line 821
      if (typeof applySkipLimit === 'function') {
            callback = applySkipLimit;
            applySkipLimit = true;
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            acaron@ineat.fr Antoine Caron
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: