You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am adding the limit and offset options to my find method but only the offset is being applied. I also tried hard coding the values but I got the same result.
I found the issue, it was because when doing { offset: ... } it was replacing the options and so the previously set limit was discarded. If you switch the order of the arguments it wouldn't happen. Anyway, I did a small fix.
Activity
dresende commentedon Mar 26, 2013
Sorry for the late response. There's no
limitoption in there, but I'm going to add it. You have 2 ways to change your code to have limit:1
2
You can mix them, but
limitis not available yet in the.find()options parameter.Moves Model.find() limit to options, adds test for it (#93)
gurufaction commentedon Mar 27, 2013
I tried your second suggestion and received an error in "order clause". I will pull your latest code and try that.
dresende commentedon Mar 27, 2013
That's probably because
req.query.limitis a string, it must be a number (useparseInt).gurufaction commentedon Mar 28, 2013
This is the only version that worked for me. The second example seems to ignore the offset even with the parseInt.
Avoids loosing previously set limit (if set) on Model.fin() (#93)
dresende commentedon Mar 28, 2013
I found the issue, it was because when doing
{ offset: ... }it was replacing the options and so the previously setlimitwas discarded. If you switch the order of the arguments it wouldn't happen. Anyway, I did a small fix.