Skip to content

afterFind breaks aggregate #4594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dblythy opened this issue Feb 28, 2018 · 4 comments
Closed

afterFind breaks aggregate #4594

dblythy opened this issue Feb 28, 2018 · 4 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@dblythy
Copy link
Member

dblythy commented Feb 28, 2018

Issue Description

Using aggregate works without afterFind set on class. When afterFind is set, internal server error. Even trying to pass response.success(request.objects); straight away still breaks.

Steps to reproduce

Perform an aggregate such as .distinct on a class with Parse.Cloud.afterFind trigger.

Expected Results

Aggregate to ignore after find as objects are not parse.objects; or values to be passed in request.objects.

Actual Outcome

Internal server error. Cannot create property 'className' on string.

Environment Setup

  • Server

    • parse-server version: 2.7.2
    • Localhost or remote server: localhost
  • Database

    • MongoDB version: 3.2
    • Localhost or remote server: localhost
@dplewis dplewis added the type:bug Impaired feature or lacking behavior that is likely assumed label Feb 28, 2018
@dplewis
Copy link
Member

dplewis commented Feb 28, 2018

@flovilmart What do you think? Should Aggregate ignore AfterFind or pass in values into request.objects?

@flovilmart
Copy link
Contributor

Yep we should probably not run afterFind after and aggregation. Does that make sense for you @dblythy ?

@dblythy
Copy link
Member Author

dblythy commented Feb 28, 2018

Sounds good @flovilmart. As it's restricted to require masterKey, any stripping/sensitive or modified fields could be written in the cloud aggregate function.

@dblythy
Copy link
Member Author

dblythy commented Mar 1, 2018

Thank you @dplewis!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

3 participants