parse-community / parse-community/parse-server

RFC: Save Triggers should be able to filter Operations

Open
#7,220 1 comment 1 reaction 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

If this is approved by the maintainers we will submit a PR in the near future

Very simple use case and i think this feature could be used in many cases. Lets say you have a counter, and you want to limit operations on it.

Feature / Enhancement Description

Since triggers can already perform validation operations on fields, add a way to validate the type of operation that are performed

Example Use Case

Parse.Cloud.beforeSave('GameScore', (request) => {

  // ....
  
}, {
  fields: {
    score: {
      required : true,
      opType :  Parse.Op.Increment 
    },
    otherTeamScore: {
      required : true,
      opType : [ Parse.Op.Unset , Parse.Op.Increment ]
    },
  }
})
Alternatives / Workarounds

In the trigger, iterate through req.object._getPendingOps()

3rd Party References

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 with the Parse.Cloud.beforeSave entry point and inspect how req.object._getPendingOps() exposes pending operations. Define the supported operation-filtering behavior from the score and otherTeamScore examples, including multiple allowed operations, and verify the trigger validation flow before considering the feature complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.