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

Querying using objects getters and setters #122

Open
danielkmb2 opened this issue Sep 6, 2016 · 1 comment
Open

Querying using objects getters and setters #122

danielkmb2 opened this issue Sep 6, 2016 · 1 comment

Comments

@danielkmb2
Copy link

Hello,

I want to retrieve the parent of an object given one of child fields. Is there any way to archieve this?

ex. Dog has name, human has name and list of dogs. Given a dog`s name i want to know its humans name.

Thanks!

@Stuart-campbell
Copy link
Owner

Stuart-campbell commented Sep 6, 2016

Hi,

I think this would have to be done in two searches.

Dog dog = new RushSearch().whereEqual("name", dogName).findSingle(Dog.class);
Parent parent = new RushSearch().whereEqual("listField", dog).findSingle();

It's unlikely you would want to use findSingle i'm sure you would want to use find and check there are actually results.

Hope that helps.

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

2 participants