parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.92k stars 4.78k forks source link

Nested pointer updates don't work #7391

Open mstniy opened 3 years ago

mstniy commented 3 years ago

New Issue Checklist

Issue Description

Updates to nested pointers don't work.

Steps to reproduce

  1. Create a Parse object with a nested pointer:
    const obj = new Parse.Object('GameScore'); // This object will include nested pointers
    const ptr1 = new Parse.Object('GameScore');
    await ptr1.save(); // Obtain a unique id
    const ptr2 = new Parse.Object('GameScore');
    await ptr2.save(); // Obtain a unique id
    obj.set('data', { ptr: ptr1 });
    await obj.save();
  2. Update the nested pointer
    obj.set('data.ptr', ptr2);
    await obj.save();
  3. Re-read the object's nested pointer field
    const obj2 = await new Parse.Query('GameScore').get(obj.id);
    expect(obj2.get('data').ptr.id).toBe(ptr2.id);

Actual Outcome

The update on the nested pointer does not take effect, so the assert fails.

Expected Outcome

The pointer should be updated as instructed.

Failing Test Case / Pull Request

Environment

Server

Database

Client

Logs

mtrezza commented 3 years ago

Thanks for reporting.

I classified this a bug with severity 3 because a known workaround exists.

Workaround: update whole field instead of nested key.

mstniy commented 3 years ago

7392 solves this only for MongoDB. The issue still exists for PostgreSQL.

mtrezza commented 3 years ago

Thanks, we'll keep this issue open as it still affects Postgres. Once we removed the Postgres adapter from Parse Server into its own repo (https://github.com/parse-community/parse-server/issues/7349), we can close this for Parse Server.