Giter Club home page Giter Club logo

Comments (4)

emerleite avatar emerleite commented on May 30, 2024

Its really a bug. I'm finishing the fix and the revision will be published in about an hour.

from node-database-cleaner.

emerleite avatar emerleite commented on May 30, 2024

Fixed by #14

from node-database-cleaner.

emerleite avatar emerleite commented on May 30, 2024

Please update your versions to 0.7.0. It corrects Issues #13, #14 and #15. Thanks for the feedback

from node-database-cleaner.

jonstorer avatar jonstorer commented on May 30, 2024

This still fails with Mongoose 2.8.2. The callback is still never called.

in mongodb/cursor.js #toArray if this.each has not values to iterate through, it will never return.

Cursor.prototype.toArray = function(callback) {
  var self = this;

  if(!callback) {
    throw new Error('callback is mandatory');
  }

  if(this.tailable) {
    callback(new Error("Tailable cursor cannot be converted to array"), null);
  } else if(this.state != Cursor.CLOSED) {
    var items = [];

    this.each(function(err, item) {
      if(err != null) return callback(err, null);

      if(item != null && Array.isArray(items)) {
        items.push(item);
      } else {
        var resultItems = items;
        items = null;
        self.items = [];
        // Returns items
        callback(err, resultItems);
      }
    });
  } else {
    callback(new Error("Cursor is closed"), null);
  }
};

from node-database-cleaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.