Skip to content

GraphQL: null on GraphQL API layer should be converted to {__op: "Delete"} #7648

Closed
@Moumouls

Description

@Moumouls

New Issue Checklist

Issue Description

Currently null values used during GraphQL mutation are not transformed by the GraphQL layer, so null is directly saved into the database. null in database could lead to unwanted behavior since query like exists: false will not resolve when the field has a null value.

Currently the GraphQL API has a lack of support to correctly unset fields. We should transform null to op Delete

Steps to reproduce

  • Create an object via graphql
  • Update a field to null
  • Query the field object with exists: false
  • Query will not resolve the object

Actual Outcome

null is saved into the DB

Expected Outcome

Null should transformed to undefined into the DB through the GraphQL API

Environment

alpha 5.0

Server

  • Parse Server version: alpha 5.0
  • Operating system: macOs
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:releasedReleased as stable versionstate:released-alphaReleased as alpha versionstate:released-betaReleased as beta versiontype: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