Skip to content

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

Description

@henrikperrochon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions