parse-community / parse-community/parse-server

When a date is set to null in mongoDB, parse server returns a Date set at 1970-01-01

Open
#7,576 6 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

New Issue Checklist
Issue Description

Parse server replaces null value with a Date set at 1970-01-01 when sending back the data for a query.

Steps to reproduce

In any collection with a Date field, set the value to null (either directly in the MongoDB or through the parse sdk, e.g. object.set('date', null))

Actual Outcome

I get a Date instead of null, set to 1970-01-01. (just like new Date(null)).

Expected Outcome

I expect the value to be null.

Environment

Server

  • Parse Server version: 4.10.3
  • Operating system: Docker image node:14-alpine
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): AWS

Database

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

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): iOS, Android, JavaScript, cURL
  • SDK version: not relevant. The network panel in Chrome shows the json sent by parse server already has the issue.
Logs

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

No source file or test is named in the issue. Reproduce the query response with a MongoDB-backed Parse Server using a Date field set to null, then trace the response serialization; done means the API returns null rather than a 1970-01-01 Date and a regression test covers that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, nodejs
Domain
api, backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.