parse-community / parse-community/parse-server
Support MongoDB's findAndModify
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
Parse does not natively support a way to issue a query and in the same operation write to the found documents. This is a concept used to uniquely process documents in an environment with concurrent operations.
Feature / Enhancement Description
Add a method set or update to Parse.Query that if set executes Parse.Query.first as a findAndModify in MongoDB.
Example Use Case
- Request A is a
findAndModifyrequest for documents that are without a "being processed" flag, which returns one document which will be flagged as being processed immediately. - Request B is the same as request A and has been issued at the time as request A. No document is returned, which ensures the same document is not being processed twice.
Alternatives / Workarounds
- Use transactions, which may have an unnecessary performance impact
- Directly access the DB adapter, see https://github.com/parse-community/parse-server/issues/4258
- Maintain a custom DB connection, directly interacting with the DB driver
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 tracing Parse.Query.first and the MongoDB database adapter, then review the direct-adapter workaround in issue 4258. Define the API behavior for an atomic find-and-modify operation and verify it with concurrent requests: one request should claim a matching document and the other should return none.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, nodejs
- Domain
- api, backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100