parse-community / parse-community/parse-server

PUT in REST API does not upsert object with custom ID

Open
#7,139 43 comments 5 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 Feature / Enhancement Checklist
Current Limitation

When integrating third party apis with server, most of them already provide the unique ids for the returned data. So right now if I want to save object with custom id it requires restful api call from node environment, and to make restful api call ( batch request ), we need to check with the server if object with custom id exist or not. If object exist then batch array requires PUT otherwise it requires POST. So it is kind of little overhead and extra management of the code. And also in fast updating environment it can cause errors ( where multiple node in same cluster checks with the backend if certain object id exist, it can cause race conditions ). so It would be nice to have support for saving objects in node environment without rest apis, and maybe upsert option when saving parse object.

Feature / Enhancement Description

So It would be great to have feature where parse server sdk supports saving object based on custom object ids ( it doesn't support at the moment in cloud code and server sdk, it requires rest api cal in node environment to save such objects with custom object id ) and one flag with something like Parse.Object.save({},{upsert:true}), which updates existing documents if object id is already there in database.

Alternatives / Workarounds

Making redundant requests to check if object exist in server

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 by tracing the REST API's PUT and POST handling alongside the Node.js Parse.Object.save entry point mentioned in the issue. Clarify how custom object IDs are currently handled and define the expected behavior for an upsert flag, including concurrent saves and existing versus new objects. Done means the behavior is specified and covered for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.