Closed
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
Since #7839, when .save is called on an object with a Pointer, all fields are cleared out on the pointer.
Steps to reproduce
it('Pointer should not be cleared by triggers', async () => {
Parse.Cloud.afterSave('MyObject', () => {
});
const foo = await new Parse.Object('Test', {foo: 'bar'}).save();
const obj = await new Parse.Object('MyObject', {foo}).save();
const foo2 = obj.get('foo');
expect(foo2.get('foo')).toBe('bar')
});
it('Can set a pointer in triggers', async () => {
Parse.Cloud.beforeSave('MyObject', () => {
});
Parse.Cloud.afterSave('MyObject', async ({object}) => {
const foo = await new Parse.Object('Test', {foo: 'bar'}).save();
object.set({foo});
await object.save(null, {useMasterKey: true});
}, {skipWithMasterKey: true});
const obj = await new Parse.Object('MyObject').save();
const foo2 = obj.get('foo');
expect(foo2.get('foo')).toBe('bar')
});
Actual Outcome
Tests fail
Expected Outcome
Tests should pass
Environment
Server
- Parse Server version:
alpha
- Operating system:
macos
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
localhost
Database
- System (MongoDB or Postgres):
mongodb