Skip to content

After calling withCount on Parse.Query, findAll returns empty array regardless of result #2621

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

Open
4 tasks done
mdarens opened this issue May 21, 2025 · 1 comment
Open
4 tasks done
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@mdarens
Copy link

mdarens commented May 21, 2025

New Issue Checklist

Issue Description

When building a query dynamically, if withCount is called before findAll, the request payload sent over REST just looks like that for a regular find query with countbatchSize is not sent as the limit, and no subsequent requests are sent with an object id cursor. Even if results come back, the SDK returns an empty array to the caller and fails silently. This appears to have regressed in the SDK at some point between 4.1.0 (where this was working previously) and 6.1.1 (where I encountered it), but I haven't pinpointed it further than that. Obviously if one is using findAll they can just use the size of the result to get the count, but this is definitely unexpected behavior. My workaround in app code is to call withCount conditionally exclusive to the condition for calling findAll.

Steps to reproduce

  1. Build a query that should have some results
  2. Call withCount(true) on the query
  3. Await findAll on the query

Actual Outcome

The result is an empty array despite the results appearing in the network tab

Expected Outcome

findAll ignores withCount when building the query, but shapes the result to match the expectation of calling with count: { count: number; results: Parse.Object<T>[] }

Environment

Chrome 136.0.7103.114 (Official Build) (arm64)
Parse JS SDK: 6.1.1
Parse Server: 8.2.0
Node: LTS 20.19.2

Server

  • Parse Server version: 8.2.0
  • Operating system: alpine Linux
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Google Cloud

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 6.0.23
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Google Cloud

Client

  • Parse JS SDK version: 6.1.1

Logs

Copy link

parse-github-assistant bot commented May 21, 2025

🚀 Thanks for opening this issue!

ℹ️ You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mdarens mdarens changed the title After calling withCount on Parse.Query, of findAll returns empty array regardless of result After calling withCount on Parse.Query, findAll returns empty array regardless of result May 22, 2025
@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

2 participants