Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration option to change the default limit on the size of query result collection #8149

Closed
vzukanov opened this issue Sep 4, 2022 · 11 comments · Fixed by #8152
Closed
Labels
type:feature New feature or improvement of existing feature

Comments

@vzukanov
Copy link
Contributor

vzukanov commented Sep 4, 2022

New Feature / Enhancement Checklist

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

@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Sep 4, 2022
@mtrezza
Copy link
Member

mtrezza commented Sep 4, 2022

That's actually a pretty easy PR. Do you want to give it a try?

@vzukanov
Copy link
Contributor Author

vzukanov commented Sep 4, 2022

I do. Just wanted to make sure you'll accept this feature.

@mtrezza
Copy link
Member

mtrezza commented Sep 4, 2022

Sure, the scope is to add a new Parse Server option for limit which defaults to 100, right?

@vzukanov
Copy link
Contributor Author

vzukanov commented Sep 4, 2022

Yep

@mtrezza
Copy link
Member

mtrezza commented Sep 4, 2022

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.

@vzukanov
Copy link
Contributor Author

vzukanov commented Sep 5, 2022

@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).

@REPTILEHAUS
Copy link

following random issues/PRs even if the 10k limit is enabled can parse performantly return this many records based on testing in this issue #6543

@vzukanov
Copy link
Contributor Author

vzukanov commented Sep 8, 2022

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.

@mtrezza
Copy link
Member

mtrezza commented Sep 8, 2022

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.

@vzukanov
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
3 participants