question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for where in RealmList query

See original GitHub issue

I couldn’t find the way to write a query like this

realm.where(Product.class).in(catId,"categories").findAll();

//Product categories 
private RealmList<RealmInt> categories;

Am I missing something?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
nathanwscommented, May 31, 2015

Just a quick note, ran into this issue when implementing the in predicate by @kneth in the second comment of this thread.

Using it exactly as written, it threw:

UnsupportedOperationException: Missing left-hand side of OR

I had to account for the first condition before the OR in the loop, something like:

RealmQuery<Product> query = realm.where(Product.class);
// ids is a list of the category ids
if (ids.size() > 0) {
   query = query.equalTo("categories.id", ids.get(0));
   for (int i = 1; i < ids.size(); i++) {
      query = query.or().equalTo("categories.id", ids.get(i));
   }
}

I know, trivial, but I figured I would comment just in case someone else ran into the same issue.

0reactions
knethcommented, Apr 26, 2016

@Sadmansamee Please open a new issue or ask at Stackoverflow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

realm - How do I query RealmObject that have RealmList that ...
I have a RealmObject (let's say Owner ) and it has RealmList<Cat> . Cat has a property name . How do I query...
Read more >
RealmQuery (Realm 7.0.0) - MongoDB
A RealmQuery encapsulates a query on a Realm or a RealmResults using the Builder pattern. The query is executed using either findAll() or...
Read more >
RealmList<RealmString> is an anti-pattern! - Medium
EDIT: Any Realm version from 4.0.0-RC1 and above supports RealmList natively, ... Simply put, a link query takes more time than a query...
Read more >
Realm Xamarin 0.74.1 - AWS
You can define a to-many relationship using RealmList properties. When you use these properties, you get back a RealmList which may be empty...
Read more >
Realm Database on Android: Getting Started
Realm database; Schema and entities; Inserting objects; Querying and ... Note: Realm supports different types of fields. ... RealmList .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found