parse-community / parse-community/parse-server
Deeply nested keys are not passed correctly to afterSave triggers
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
afterSave triggers do not receive the correct updated object, if a deeply nested key was updated.
Steps to reproduce
- Create an afterSave trigger for a class
- Create a document with a deeply nested key:
const obj = new Parse.Object('GameScore');
obj.set('a', {'b':{'c':0}});
await obj.save();
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue by saving an object with a deeply nested key, changing it with obj.set('a.b.c', 1), and saving again. Inspect the afterSave trigger's request.object and verify that a contains {'b':{'c':1}}; the issue body indicates that a fix and test case were already submitted.
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
- 20/100