parse-server
parse-server copied to clipboard
Configuration option to change the default limit on the size of query result collection
New Feature / Enhancement Checklist
- [ x ] I am not disclosing a vulnerability.
- [ x ] I am not just asking a question.
- [ x ] I have searched through existing issues.
Current Limitation
By default, all queries have a limit of 100 on the returned collection size. This limit can be changed by invoking query.limit(<some number>) in JS or analogous methods in other SDKs, but this approach is cumbersome and error-prone.
I think that giving Parse-Server users an ability to change the default limit on the server side would be great.
Feature / Enhancement Description
Additional startup configuration option that changes the default query result size limit.
Proposed name: queryResultSizeLimit
Example Use Case
parse-server \
--publicServerURL https://domain/parse \
--appName app \
--databaseURI mongodb://localhost:27017/app \
--appId appId \
--queryResultSizeLimit 10000
Alternatives / Workarounds
The current workaround is to change the limit manually in all queries on the client side. If there are multiple clients, all of them need to perform these changes.
3rd Party References
Thanks for opening this issue!
- 🎉 We are excited about your ideas for improvement!
That's actually a pretty easy PR. Do you want to give it a try?
I do. Just wanted to make sure you'll accept this feature.
Sure, the scope is to add a new Parse Server option for limit which defaults to 100, right?
Yep
Great, if you need any help just comment. Regarding adding a new option I suggest to read through the Contributions Guide which has a comprehensive chapter dedicated to that.
@mtrezza , I opened a PR with my changes. Will appreciate if you could assist me with merging it.
In addition, I wonder if it would be possible to backport this change to version 4.x of Parse Server (that's what we use and I wouldn't like to migrate now).
following random issues/PRs even if the 10k limit is enabled can parse performantly return this many records based on testing in this issue https://github.com/parse-community/parse-server/issues/6543
We're building a fully-offline app. Therefore, we need to fetch all the required information upfront and store it in the local database on mobile devices. In this case, pretty much all our queries should have no limit. If we'll see any specific perf bottleneck, we'll optimize it then. In general, I think that deafult query limits are leftover from the parse.com days. When this platform was run by a company and there were users on free tiers, it made sense to restrict the amount of traffic to avoid poorly written apps from overwhelming the infrastructure. However, once Parse Server became self-hosted, any default limit is just a foot-gun waiting to go off on less experienced users. It would be more user-friendly to remove any limit and let the users deal with perf bottlenecks if they appear (my hunch is that most Parse Server users would never run into real issues in this context). Anyway, all this is water under the bridge now. Once we merge this new config option, we'll be able to work around the default limit without polluting the source code of all the clients. @mtrezza , just a reminder about this PR.
I wonder if it would be possible to backport this change to version 4.x of Parse Server (that's what we use and I wouldn't like to migrate now)
We only actively backport security fixes to 4.x LTS. If you would like to see this backported, you'd need to open another PR for the release-4.x.x branch. I assume it's mostly copy / paste.
@mtrezza , I incorporated your feedback into my PR. There is one change you requested which I tried to perform, but looks like it isn't required. I left a detailed explanation in the PR. Please take a look and approve if my explanation makes sense.