Skip to content

Pointer disappears in query results in CloudCode #3913

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
mtrezza opened this issue Jun 8, 2017 · 4 comments
Closed

Pointer disappears in query results in CloudCode #3913

mtrezza opened this issue Jun 8, 2017 · 4 comments

Comments

@mtrezza
Copy link
Member

mtrezza commented Jun 8, 2017

Issue Description

When using a particular combination in a CloudCode query of include, greaterThan, lessThan, doesNotMatchKeyInQuery the included field goes missing in the query result objects.

Steps to reproduce

Create query and execute:

var query = new Parse.Query(UserProfileClass);
query.include("user"); // This is a poiner to a `_User` class object.
query.greaterThan("updatedAt", date1);
query.lessThan("updatedAt", date2);
query.doesNotMatchKeyInQuery("user", "user", anotherQuery); // AnotherQuery returns objects with a field `user` that is a pointer to a `_User` class object.
query.find();

Expected Results

The query results should contain the "user" field with its fields because of the include parameter.

Actual Outcome

The query results do not contain the "user" field.
However, when any of the query parameters is commented out, e.g. doesNotMatchKeyInQuery or greaterThan, then the "user" field is properly included.

Environment Setup

  • Server

    • parse-server version: 2.4.1
  • Database

    • MongoDB version: 3.2.11
@mtrezza
Copy link
Member Author

mtrezza commented Jun 8, 2017

Solution was to use query.find({useMasterKey: true});. Closing issue, although really confusing behaviour as described.

@mtrezza mtrezza closed this as completed Jun 8, 2017
@natanrolnik
Copy link
Contributor

The _User class is protected by ACLs, so searching for it without the correct Session Token for that user, or without the Master Key, won't return the the user object. Otherwise, anyone could get your users info...

That's expected. Where did you find confusing? If it's in the docs, can you point us to where, so we can improve it?

@mtrezza
Copy link
Member Author

mtrezza commented Jun 9, 2017 via email

@flovilmart
Copy link
Contributor

You can/should pass the sessionToken from the authenticated user to run that query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants