parse-community / parse-community/parse-server

Aggregate cannot correctly aggregate date fields

Open
#6,729 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

Issue Description

I need to count the new data every day

group: {
    objectId: { day: { $dayOfMonth: "$createdAt" }, month: { $month: "$createdAt" }, year: { $year: "$createdAt" } },
    count: { $sum: 1 },
},

Result:
image

Expected Results

Count the same date together

Environment Setup
  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.0.8&4.2.0
    • Operating System: ubuntu
  • Database
    Postgresql 10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided aggregation with parse-server 3.0.8/4.2.0 and PostgreSQL 10, using the $dayOfMonth, $month, and $year expressions on createdAt. Compare the resulting groups with the expected calendar-date grouping; done means records from the same date are counted together.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.