Skip to content

Deeply nested keys are not passed correctly to afterSave triggers #7384

Open
@mstniy

Description

@mstniy

New Issue Checklist

Issue Description

afterSave triggers do not receive the correct updated object, if a deeply nested key was updated.

Steps to reproduce

  1. Create an afterSave trigger for a class
  2. Create a document with a deeply nested key:
const obj = new Parse.Object('GameScore');
obj.set('a', {'b':{'c':0}});
await obj.save();
  1. Change the deeply nested key
obj.set('a.b.c', 1);
await obj.save();

Actual Outcome

The afterSave triggers receives a wrong object (in request.object)

Expected Outcome

In the trigger call for the second save(), the field a of the received object should be {'b':{'c':1}}

Failing Test Case / Pull Request

  • 🤩 I submitted a PR with a fix and a test case.
  • 🧐 I submitted a PR with a failing test case.

Environment

Server

  • Parse Server version: Latest commit as of 12 May 2021, 51e0800
  • Operating system: any
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

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

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): any
  • SDK version: any

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: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