parse-community / parse-community/parse-server
Saving cloned object returns same objectId
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
- 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
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
- Clone a User object with
authDataset - save that object using
Parse.Object.saveAll - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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