我有两个收藏:
- Post
- Comment
Post.comments = [comment1, comment2, ...]
comment.removed
是一个布尔值。
我想获取所有帖子,但不comments
包括已删除的帖子。有没有办法在不迭代 OneToMany 关系的情况下做到这一点?
这是我尝试过的:
ANY comments.removed == FALSE // Posts that have at least one removed comment
ALL comments.removed == FALSE // Posts that only have unremoved comments
(SUBQUERY(comments, $x, $x.removed == FALSE).@count > 0) // Same as the first one