edwardhotchkiss / mongoose-paginate

Mongoose.js (Node.js & MongoDB) Document Query Pagination
MIT License
984 stars 218 forks source link

get all results- limit:infinity doesn't work. #114

Open rusiarohit opened 7 years ago

rusiarohit commented 7 years ago

Hey Guys,

I used to use the { limit: Infinity, offset: 0 } feature to get all the items while using mongoose paginate module as pagination parameters.

After updating the version of my mongoose and mongoose paginate module it seems to have stopped working. Please suggest the new solution. limit value must be non-negative

Old NPM version of of mongoose and mongoose paginate.

{"mongodb":"1.4.38", "mongoose": "3.8.8", "mongoose-paginate": "5.0.0"}

New NPM version:

"mongodb":"2.2.16", "mongoose": "4.7.3", "mongoose-paginate": "5.0.0"

Mongo Database Version: 3.2

This is where I learned about infinity feature

Thanks for the help. RR

ramonitor commented 6 years ago

Setting limit to Number.MAX_SAFE_INTEGER seems to work fine. Not exactly sure why Infinity is not working, but I guess it has something to do with accepted cursor limits on the Mongo driver.