parse-community / parse-community/parse-server
Add an overide for the increment function to allow user to specify siginificant digits
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
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
Current Limitation
When using the parseObj.increment function, there is no way to account for floating point arithmatic errors. For example, if in the database I have a Quantity Column, and it has a value of 6.5 and I want to call `someObj.increment("Quantity", -4.1) instead of 2.4 being saved to that column 2.4000000000000004 is saved instead. From what I can tell there is no way to use the increment function and have it account for this. you have to do the math yourself and use set, which is not an option for us in thie case
Feature / Enhancement Description
make an override to the increment function that takes an additional parameter specifying the number of significant digits
Example Use Case
if in the database I have a Quantity Column, and it has a value of 6.5 and I want to call `someObj.increment("Quantity", -4.1) instead of 2.4 being saved to that column 2.4000000000000004 is saved instead. From what I can tell there is no way to use the increment function and have it account for this. you have to do the math yourself and use set, which is not an option for us in thie case
Alternatives / Workarounds
Using Set and the save would work, but given this column sees alot of traffic at once, it raises concerns of a race condition happening which can lead to an inacurate count which is why we use the increment function rather than set and save.
3rd Party References
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 by locating the parseObj.increment entry point and the tests covering increment persistence. Define how the significant-digits parameter should behave for floating-point increments, then verify the result remains atomic and preserves the race-condition safety described in the issue; add or update tests showing 6.5 incremented by -4.1 produces the intended rounded value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100