Skip to content

[DISCUSSION] Aggregate Queries #4197

Closed
Closed
@dplewis

Description

@dplewis

I wanted to start a discussion on the best way to implement Aggregate Queries into Parse Server.
Starting with the REST

curl -X GET \
    -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
    -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
    -G \
    --data-urlencode 'sum=score&groupby=createdAt&groupcount=true&order=-createdAt' \
    http://localhost:1337/classes/GameScore

or

curl -X GET \
  -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
  -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
  -G \
  --data-urlencode ' \
    $match: { score: 1337 }, \
    $group: { _id: null, score: { $sum: "score" } }, \
    $sort: { score: -1 }' \
  https://localhost:1337/classes/GameScore

For Postgres we could build a basic aggregate to SQL transform and let the community build it.
Similar to
https://docs.mongodb.com/manual/reference/sql-aggregation-comparison/

For the SDK we could have a query.aggregate()

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions