1

I have a Realm objects User, Session, HeartSession which has the following structure.

User {
    UUID: String (primary key)
    RealmList<Sessions> sessions
}

Session {
    UUID: String (primary key)
    RealmList<HeartSession> heart
}

HeartSession {
    UUID:String (primary key)

}

I have specific User object. I need to access all the heart recordings associated with this particular user object? What is the best way to do so?

I have tried this Query,

val heartSearchQuery = user?.sessions?.where()?.isNotNull("heart") 

But the above query does not return values correctly.

User
  • 1,186
  • 4
  • 22
  • 36
  • what queries have you tried with Realm. show us what you've tried – Farhad Feb 25 '16 at 14:02
  • `isNotNull()` throws on non-nullable fields. See https://realm.io/docs/java/latest/api/io/realm/annotations/Required.html . Your case will be supported by back link query well https://github.com/realm/realm-java/issues/607 . But unfortunately it is not supported yet. Now I think you need to iterate all `sessions` to access every `HeartSession`. – beeender Feb 26 '16 at 01:58

0 Answers0