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

add possibility to stop cursor.each() iteration

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0
    • Affects Version/s: None
    • Component/s: 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:
            christkv Christian Amor Kvalheim
            Reporter:
            socketpair ????????? ????
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: