Skip to content

Triggering particular function inside afterSave #3268

Closed
@srameshr

Description

@srameshr

Issue Description

How do I trigger a particular function inside afterSave for a given collection.

As of now I manually set a column called updateType and then inside the afterSave block I check for the value of updateType on the request object.

Steps to reproduce

Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.

In Parse.Cloud.define()

  var query = new MyCollection();
  query.set("updateType", "update-1");
  query.save();

In Parse.Cloud.afterSave()

Parse.Cloud.afterSave('MyNewCollection', function(request, response) {
  function a() {
  }

  function b() {
  }

  if(request.updateType === 'updated-1') {
    a(); // Call function a
  }
});

Is there any other way to do this. Any option that lets me choose what block of code should be executed inside afterSave after a collection had been saved.

Expected Results

NONE

Actual Outcome

NONE

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.3.0
    • Operating System: MAC OSX 10.11.16 EL Capitan
    • Hardware:
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Localhost
  • Database

    • MongoDB version: db version v3.0.12
    • Storage engine: Default storage
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Localhost

Logs/Trace

You can turn on additional logging by configuring VERBOSE=1 in your environment.

[FILL THIS OUT]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions