Skip to content

Relations in query #229

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
michaldev opened this issue Jul 27, 2019 · 12 comments
Closed

Relations in query #229

michaldev opened this issue Jul 27, 2019 · 12 comments

Comments

@michaldev
Copy link

michaldev commented Jul 27, 2019

I have class "Product" with category (relational) field. I added product and category by Parse dashboard.

but I have problem:
"category":{"__type":"Relation","className":null,"objects":null}}
I search item by query:

var queryProduct = QueryBuilder(ParseObject('Product'))
      ..whereContains('name', text);
@RodrigoSMarques
Copy link
Contributor

Hi @michaldev

What version are you using?

@vonbarnekowa
Copy link

Hey!

I have the same issue. I'm running on 1.0.22.

@RodrigoSMarques
Copy link
Contributor

I didn't do tests with relational.
I'll do some tests and return to you

@vonbarnekowa
Copy link

Thank you.

@RodrigoSMarques
Copy link
Contributor

RodrigoSMarques commented Aug 3, 2019

Hi guys.
Reading the Parse documentation what I understand is that ParseRelation does not return results in the query.
I also checked the documentation for Android and Java Script.
For Flutter, You need to fetch the relationship objects using

final relation = user.getRelation ('dietPlans');

I did a test and it seems this didn't work in lib.
I will debug and then return the result.

@WahdanZ
Copy link
Contributor

WahdanZ commented Aug 3, 2019

@RodrigoSMarques
in query builder, you should use this
queryBuilder.includeObject(["category"]);

@RodrigoSMarques
Copy link
Contributor

@WahdanZ
include doesn't work with Relations, only with Pointers

parse-community/parse-server#4138
parse-community/parse-server#2850
https://stackoverflow.com/questions/45645985/parse-sdk-android-query-with-relation-using-include-is-not-working

@michaldev and @vonbarnekowa
use whereRelatedTo to retrieve objects in relation, in separated Query.

@vonbarnekowa
Copy link

I found another issue. I don't know if they are related to each other. But if you have a relation that contains more than one item, the result will be null. With one or zero items it works.

@ZeroNilZero
Copy link

@vonbarnekowa how do you fix that?

I found another issue. I don't know if they are related to each other. But if you have a relation that contains more than one item, the result will be null. With one or zero items it works.

@facuparedes
Copy link
Contributor

Hey, I have same problem:
"messages":{"__type":"Relation","className":null,"objects":null}

Did anyone fix that?

@ZeroNilZero
Copy link

this may help #399

@RodrigoSMarques
Copy link
Contributor

We are closing issues that have been open for a long time without activity.
This will make it easier to organize things from now on.
If the problem persists, please open a new issue.
Thanks.

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

6 participants