Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Allow saving with custom objectId #1097
Comments
|
At first, I thought of adding I can add save(target, options) {
// ...
const isCustomObjectId = CoreManager.get('CUSTOM_ID');
if (target.isNew() && isCustomObjectId) {
target.id = target._localId;
}
// ...
}or just change the _getSaveParams() {
const method = this.id ? 'PUT' : 'POST';
let path = 'classes/' + this.className;
if (this.id) {
path += '/' + this.id;
} else if (this.className === '_User') {
path = 'users';
}
if (this.isNew() && CoreManager.get('CUSTOM_ID')) {
this.id = this._localId;
}
const body = this._getSaveJSON();
return {
method,
body,
path
};
}I'm not sure if |
|
Do we also need to support reverting |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Is your feature request related to a problem? Please describe.
This feature was already merged on Parse Server but I just tried it with this SDK and got the result of
Object not foundand upon looking up, ParseObject#L313 was the cause of it because if it detects an objectId being present, it will simply update the object hence thePUTmethod. Correct me if I'm wrong.Describe the solution you'd like
Ability to set
objectIdwithout making an update to the non-existent record.Describe alternatives you've considered
For now, we could just use REST API to manually create an object.
Additional context
I thought of a solution that we could check if it is new or not but looking up to
isNewmethod, it checks whetherthis.idis present or not and unfortunately, hitting save will automatically replacethis.idtheobjectIdwe assigned to it.