add possibility to stop cursor.each() iteration

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Done
    • Priority: Major - P3
    • 2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None

      It will be nice if cursor.each() will check for return code of callback. Based on this it should escape from iteration. See http://api.jquery.com/each for example of such API.

      Usa case: get only 20 documents, for example

      items = []
      cursor.each(function(err, item) {
         if (err != null)
            return false;
         items.push(item);
         if (items.length >= 20) {
           return false;
         }
         return true;
      });
      

              Assignee:
              Christian Amor Kvalheim
              Reporter:
              ????????? ????
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: