Skip to content

Pointers are stripped out after calling .save #7912

Closed
@dblythy

Description

@dblythy

New Issue Checklist

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

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