Skip to content
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

Parse/Node: Problems with select and include after merging GH-2809 GH-2737 #2876

Closed
uluru-phatnguyen opened this issue Oct 17, 2016 · 11 comments

Comments

@uluru-phatnguyen
Copy link

I use

Parse = require('parse/node');

After upgrade parse-server to 2.2.22, I have problems with my code:

var query = new Parse.Query(ClassA);
query.select(['field1', 'field2', .., 'createdBy']); // createdBy is pointer of Parse.User
query.include('createdBy');
query.include('createdBy.shop'); // shop is pointer of Class Shop

I tracked on github, I think problems from 2 pull-request GH-2809, GH-2737.

Please suggest for me solution for this problems.

Many thanks.

@flovilmart
Copy link
Contributor

this should be fixed by #2809 actually, can you try using in your package.json:

"parse-server": "parseplatform/parse-server#latest"
?

@developerX
Copy link

@flovilmart I am having the same issues, destroyed my node_modules, did a reinstall and got the same error with basic query. As soon as I use a select the include goes away and the funny thing is that when you use both the __type attribute changes from Pointer to Object, so I am not sure if that is normal or not?

@developerX
Copy link

after reviewing your new update for select keys, I see that the select needs to have the __type as Pointer rather then Object, do you think that is where the issue resides? @flovilmart

@flovilmart
Copy link
Contributor

@developerX what version are you running? Are you running on the #latest instead of 2.2.22?

@developerX
Copy link

@flovilmart yeah I am running the latest with your code snippet from above inside my package.json file

@flovilmart
Copy link
Contributor

@developerX
Copy link

Yeah I am so I did a little more testing and it seems like you have to be specific on what you would like to include when using a select statement.

Here is what I am running into. When I run a query and use include with no select it will include the entire pointer the way I would like.

When I use a select that same pointer return only the the special indexes (objectId, createdAt, updatedAt, etc.) and nothing else.

With the provided information above by @uluru-phatnguyen he would be able to achieve what he wants by simply adding "createdBy.shop" into his select statement and it should do what they want.

Looking at the test that was written for "gameScore" it would pass because it provides an ID and the other field is not defined.

if you try writing a test with nested pointers the test will fail because the select strips all additional information before the include can even include the other fields.

Does that make any sense?

@developerX
Copy link

@flovilmart

@flovilmart
Copy link
Contributor

@developerX why don't you write a failing test for showing exactly what you mean or even better, propose a PR?

@uluru-phatnguyen
Copy link
Author

@flovilmart
I use parse/node for client, not in cloud code. I not use directly parse-server.

DO NOT specific:

"parse-server": "parseplatform/parse-server#latest"

Any the best solution?

@developerX
Thanks.

@flovilmart
Copy link
Contributor

If you don't use parse-server then this is not an issue.

When using select in conjunction with include, you should also call add all the keys you want to have with your include.

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