-
-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
@JeromeDeLeon Thanks for your suggestions. Have global config The next problem is with @parse-community/core-maintainers Thoughts? |
It looks a good approach. |
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 found
and 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 thePUT
method. Correct me if I'm wrong.Describe the solution you'd like
Ability to set
objectId
without 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
isNew
method, it checks whetherthis.id
is present or not and unfortunately, hitting save will automatically replacethis.id
theobjectId
we assigned to it.The text was updated successfully, but these errors were encountered: