Parse-server: Saving pointer saves whole object

Created on 13 Sep 2019  路  4Comments  路  Source: parse-community/parse-server

Issue Description

Saving a User pointer in an array saves the whole object.
Possibly related to https://github.com/parse-community/parse-server/issues/691.

Steps to reproduce

  1. Open Parse Dashboard.
  2. Add a class with a column of type array.
  3. Add a pointer value of an existing user to the array, e.g.
[{
    "__type": "Pointer",
    "className": "_User",
    "objectId": "EXISTING_OBJECT_ID"
}]
  1. Pointer is saved correctly (check directly in DB, not via parse dashboard)
  2. Click on refresh in parse dashboard data browser.
  3. Item in array is not displayed as Pointer but as Object containing all fields, e.g.
[{
    "__type": "Object",
    "className": "_User",
    "objectId": "EXISTING_OBJECT_ID",
     (+ all other fields of the object)
}]
  1. Pointer is still saved correctly in DB (check directly in DB, not via parse dashboard)
  2. Double click on array field in parse dashboard and exit editing mode
  3. Pointer has been replaced by Object in DB

Notes:

  • This does not happen right after starting the server. It seems that the user needs to be cached or something. For me it happens when I do it in a class that contains a relation field where the user is added and I first add the user to an array there. The issue then occurs in every other class as well. I haven't quite nailed down the pattern yet.
  • The class where it occurs has no beforeSave / afterSave hook.

  • This actually seems to be a Parse Dashboard issue rather than a Parse Server issue.

Expected Results

Pointer value should be added to array as is.

Actual Outcome

The whole object is added to the array.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.4.4, 3.9.0
    • parse-dashboard version (Be specific! Don't say 'latest'.) : 2.0.2
    • Operating System: -
    • Hardware: -
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): -
  • Database

    • MongoDB version: 3.6.12
    • Storage engine: MongoDB
    • Hardware: -
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): -

Logs/Trace

(none)

bug

All 4 comments

It is probably a bug in the Parse Dashboard. It seems like a corner case of this bug that was recently addressed: https://github.com/parse-community/parse-dashboard/pull/1223

I will take a look on this.

I have found just one issue.
When editing the following array, its value is rendered correctly on parse-dashboard but the changes aren't persisted. When you hit the refresh button, "foo" attribute disappears.

[
  {
    "__type": "Pointer",
    "className": "_User",
    "objectId": "fRnZ0N8667",
    "foo": "bar"
  }
]

@douglasmuraoka thanks for reporting. It should not save the attribute. So I pushed one more commit to the PR in which we do not show invalid pointers anymore after commiting a change. Can you please take a look again?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kilabyte picture kilabyte  路  4Comments

LtrDan picture LtrDan  路  4Comments

mohmagdy picture mohmagdy  路  3Comments

ViolentCrumble picture ViolentCrumble  路  3Comments

dovewi picture dovewi  路  3Comments