parse-community / parse-community/parse-server

Saving cloned object returns same objectId

Open
#7,422 14 comments 0 reactions 0 assignees View on GitHub

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
Issue Description

Saving a cloned object which had authData set, returns new object with same objectId for _User class.
Issue originally discovered in https://github.com/parse-community/parse-dashboard/pull/1697.

Steps to reproduce
  1. Clone a User object with authData set
  2. save that object using Parse.Object.saveAll
  3. or try this code
let q = new Parse.Query('_User');
q.equalTo('objectId', 'EiWF4cUw9P'); // any User objectId which has authData set
const res = await q.find({ useMasterKey: true });
let toClone=[];
for (const object of res) {
  toClone.push(object.clone());
}
await Parse.Object.saveAll(toClone, { useMasterKey: true });
Actual Outcome

returns object with same objectId & other fields as well.

Expected Outcome

should have new objectId & unique username

Failing Test Case / Pull Request
  • 🧐 I submitted a PR with a failing test case.
  • 🤩 I submitted a PR with a fix and a test case.
Environment

Server

  • Parse Server version: 4.5.0
  • Operating system: Ubuntu
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): irrelevant
  • SDK version: irrelevant
Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Parse.Query and Parse.Object.saveAll flow shown in the reproduction, focusing on cloning _User objects that contain authData and the MongoDB persistence path. Reproduce with Parse Server 4.5.0 and MongoDB 4.4. Done means the cloned user receives a new objectId and unique username, with a regression test covering saveAll.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.