Open astigsen opened 9 years ago
I just added a a similar issue to Java: https://github.com/realm/realm-java/issues/2232 It sprang up after a discussion on how to document link queries and would be an extremely powerful tool to do some advanced queries.
I think the term often used in functional programming is collect
An example of a query that cannot be expressed using any of our current capabilities: https://stackoverflow.com/questions/45529557/realm-querying-with-two-conditions-at-the-same-time/45659934#45659934
@cmelchior, doesn't that simply require a subquery, which is already supported by Core? It can be expressed in Cocoa using a predicate like SUBQUERY(birds, $bird, $bird.type = 2 AND $bird.species.value = 3).@count > 0
. That forces both the type and species value portions of the query to be evaluated on the same bird, which looks to be what the user is asking for.
Good point. I forgot about subqueries and aggregates, mostly because Java doesn't support them yet.
Right now all queries return objects from the root of the query (i.e. even if you are querying down through links, you are only able to use it to filter the set you started with). With a
gather
operator, you would be able to collect objects at bottom of the query instead.An example would be if you wanted to get a list of all dogs owned by friends of yours:
This kind of operator is often needed for graph queries.