If I have an array of primitive values, how can I run a .not().contains() on a .where() from RealmResults ?
The code would hopefully look like this:
results.where().not().contains("id", new int[] {1, 2, 3})
Or do I have to iterate over all of these results and pluck them out individually?
You can try beginGroup and then not in to query against the Arrays
realm1.where(UserModel.class)..beginGroup().not().
in("key",Your Array)).endGroup().findAll();
There is no such method to query against the arrays as of now . The second paramater of contains() requires a string so you cant pass int[] or int . Iterating over the result is the only option .
RealmQuery q = users.where();
for (int id : ids) {
q = q.notEqualsTo("id", id);
}
RealmResults<users> users = q.findAll();
You can use between() if you need to query against a range of value .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With