Reputation: 97
I'm using realm.io 0.90 with objective c. I'm able to save/edit/delete objects with their relationships without a problem.
Here is my database schema: class A that has an array of class B. And class B has an array of class C (A->B->C)
I need to query for all As with any B that have C.name = "something"
Any ideas how to do it?
Upvotes: 2
Views: 1216
Reputation: 7806
You can use here the NSPredicate-based Query-API.
// Query using an NSPredicate object over multiple relations
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY bs.cs.name = %@",
@"something"];
RLMResults *asWithCsNamedSomething = [A objectsWithPredicate:predicate];
Upvotes: 6