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

Array of Primitives: Support queries #5361

Open
cmelchior opened this Issue Oct 1, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@cmelchior
Contributor

cmelchior commented Oct 1, 2017

Split from #5031

We need to add support for arrays of values to RealmQuery. Based on API discussions we don't want to add a ton of extra methods, so instead we are going to use the empty field name "" when querying arrays of primitives.

E.g

public class Person extends RealmObject {
  public RealmList<String> names;
}

// Query list directly
Person p = getPerson();
RealmResults<String> results = p.names.where().like("", "Jo*").findAll();

// Query list in object
RealmResults<Person> results =  realm.where(Person.class).equalTo("names", "John").findAll();
```

This also include support for `RealmList.min()/max()/average()/sum()/minDate()/maxDate()` which depends on the query system
@Zhuinden

This comment has been minimized.

Contributor

Zhuinden commented Oct 5, 2017

I actually think

// Query list in object
RealmResults<Person> results =  realm.where(Person.class).equalTo("names", "John").findAll();

has a higher importance than the others, so that you can replace RealmString link queries with it.

@cmelchior

This comment has been minimized.

Contributor

cmelchior commented Oct 5, 2017

Yes. No doubt about that

@vivekkiran

This comment has been minimized.

Contributor

vivekkiran commented Dec 14, 2017

Any progress/updates on this? I am eagerly waiting for this feature to support the primitive list from my Wordpress API the native way without a wrapper. :)

@Zhuinden

This comment has been minimized.

Contributor

Zhuinden commented Jan 2, 2018

Agreed, I was hoping for end of 2017, but maybe this year 😄

Surprised it's blocked, I thought subtable query does this.

@mgohin

This comment has been minimized.

Contributor

mgohin commented Apr 27, 2018

+1, I have to use .findAll() and filter in java :(

@Zhuinden

This comment has been minimized.

Contributor

Zhuinden commented Apr 27, 2018

@mgohin another option of course is to map the list into a single string field with some convention like |value1|value2|value3| and then contains("flatList", "|${searchValue}|")

But that's lame that we still have to do that, i agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment