parse-community / parse-community/parse-server

Support MongoDB's findAndModify

Open
#7,819 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Feature / Enhancement Checklist
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
  1. Request A is a findAndModify request for documents that are without a "being processed" flag, which returns one document which will be flagged as being processed immediately.
  2. 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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.