Skip to content

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

@mdarens

Description

@mdarens

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions