question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongoError: Failed to parse 'limit' field must be numeric

See original GitHub issue

Kind of “straight forward” that ‘limit’ field must be numeric, but in scenario that I got limit from req.query.limit in Express it brings in some, in my opinion, unnecessary “string to number conversion code”.

In version 4 everything worked also if limit was string. Not realy a bug, but maybe you can bring this string conversion back in mongoose-paginate core?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
wangjiafenghwcommented, Dec 14, 2018

like cmd talk to you, the value of “limit” must be a number value, my code alse have this bug ,i just add parseInt() ,like this query.limit(parseInt(param.pageSize)), it become work

3reactions
anilbhanushalicommented, Jan 26, 2016

This was not an issue in earlier version of mongodb(2.x) it is only when i switched to 3.2.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

'the limit must be specified as a number' error when using req ...
The fix is to use parseInt like this: var show = parseInt( req.query.show ), // the number of items to show per page....
Read more >
Unable to Parse Integers in updateMany Command - MongoDB
And get this error message: **MongoServerError:** Failed to parse number 'helpful' in $convert with no onError value: Did not consume whole ...
Read more >
JavaScript Developers Guide | Parse - Parse Docs
Parse automatically figures out which data has changed so only “dirty” fields will be sent to the Parse Cloud. You don't need to...
Read more >
Looker error catalog | Google Cloud
There is a typo in a field name or in a reference to the field. · The field is excluded from an Explore...
Read more >
Does not work search | NodeBB
MongoError : Failed to parse: { find: "searchpost", filter: {}, projection: { _id: 0, id: 1 }, limit: "50" }. 'limit' field must...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found