Skip to content

$select with query not work #2795

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
Meovel opened this issue Sep 28, 2016 · 1 comment
Closed

$select with query not work #2795

Meovel opened this issue Sep 28, 2016 · 1 comment
Labels
type:question Support or code-level question

Comments

@Meovel
Copy link

Meovel commented Sep 28, 2016

Issue Description

Queries that contain a $select query on pointer fields always return empty result - unable to handle inner $select query.

Steps to reproduce

Setup
There is a user, a quiz belonging to the user and some game records of that quiz:
User:

curl -X GET \
-H "X-Parse-Application-Id: appid"  \
-H "X-Parse-REST-API-Key: restkey"  \
128.00.00.00:1337/classes/_User/ggz9FqKTFI
{"objectId":"ggz9FqKTFI","username":"Test",
"createdAt":"2016-09-26T17:00:56.365Z","updatedAt":"2016-09-26T17:00:56.365Z"}

Quiz - owner points to above user:

curl -X GET \
-H "X-Parse-Application-Id: appid"  \
-H "X-Parse-REST-API-Key: restkey"  \
--data-urlencode 'include=owner'  \
128.00.00.00:1337/classes/Quiz/GSdG0hSNgN
{"objectId":"GSdG0hSNgN","name":"testQuiz",
"owner":{"objectId":"ggz9FqKTFI","username":"Test",
"createdAt":"2016-09-26T17:00:56.365Z","updatedAt":"2016-09-26T17:00:56.365Z",
"__type":"Object","className":"_User"}
"createdAt":"2016-09-26T17:00:56.365Z","updatedAt":"2016-09-26T17:00:56.365Z"}

Game record - of above quiz:

curl -X GET \
-H "X-Parse-Application-Id: appid"  \
-H "X-Parse-REST-API-Key: restkey"  \
--data-urlencode 'include=quiz'  \
128.00.00.00:1337/classes/Game/gVKtQt2lDE
{"objectId":"gVKtQt2lDE","score":95,
"quiz":{"objectId":"GSdG0hSNgN","name":"testQuiz",
"createdAt":"2016-09-26T17:00:56.365Z","updatedAt":"2016-09-26T17:00:56.365Z",
"__type":"Object","className":"Quiz"}
"createdAt":"2016-09-26T17:00:56.365Z","updatedAt":"2016-09-26T17:00:56.365Z"}

Problem
Below query is to retrieve play records of quizzes belonging to a certain user,

curl -X GET \
-H "X-Parse-Application-Id: appid"  \
-H "X-Parse-REST-API-Key: restkey"  \
-G --data-urlencode \
'where={"quizling":{"$select":
{"query":{"className":"Quiz",
"where":{"owner {"__type":"Pointer","className":"_User","objectId":"ggz9FqKTFI"}}},
"key":"objectId"}}}' \
128.00.00.00:1337/classes/Game/

The inner query $select gets the object ids of all quizzes of a user and then out query grabs all game records points to any of the ids.

The parse sever returns:

{"results":[]}

The same query returns expected result on parse.com:

{"results":
[{"objectId":"gVKtQt2lDE","score":95,
"quiz":{"objectId":"GSdG0hSNgN",
"createdAt":"2016-09-26T17:00:56.365Z","updatedAt":"2016-09-26T17:00:56.365Z",
"__type":"Object","className":"Quiz"}
"createdAt":"2016-09-26T17:00:56.365Z","updatedAt":"2016-09-26T17:00:56.365Z"}]}

Same query works fine on parse.com, all queries like this with $select on a pointer field will return empty on parse-server.

I think it is supposed to be supported in #2737 , if not please consider it for future release, thanks.

Environment Setup

  • Server
    • parse-server version: 2.2.22
    • Localhost or remote #server: Remote server on AWS
@Meovel Meovel changed the title $select on pointer fields not work as expected $select with query not work Oct 4, 2016
@flovilmart
Copy link
Contributor

I believe this issue has been fixed since, can you update to latest version and reopen if necessary?

@mtrezza mtrezza added type:question Support or code-level question and removed 🔧 troubleshooting labels Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

3 participants