Based on the example below, Is it possible to query Profile
based on two fields within a ``LinkingObjects, such as
friendSent`? I have a profile type and a friend request type:
class Profile: Object {
// ...
@Persisted(originProperty: "sender") var friendSent: LinkingObjects<FriendRequest>
@Persisted(originProperty: "recipient") var friendRcvd: LinkingObjects<FriendRequest>
}
class FriendRequest: Object {
@Persisted var sender: Profile!
@Persisted var recipient: Profile!
@Persisted var status: RequestStatusEnum = .active
}
`
I'd then like to make a query for a `@ObservedResults(Profile.self) var users`
profile = Profile(…) // some profile
let friends_of_profile = users.where({
($0.friendRcvd.sender == profile && $0.friendRcvd.status == .active)
&& ($0.friendSent.recipient == profile && $0.friendSent.status == .active)
});
This nearly works, however, the individual clauses for `friendSent` and `friendRcvd` don't seem to be applied to only the same document. So I'm seeing the clauses for `$0.friendRcvd` evaluate to `true` if there exists a document where `.sender == profile` and one where `.status == .active`, but they aren't necessarily the same one.
Is it possible to write a query that requires those two filters to be applied to the same document?
Thanks!