因此,我有一个嵌入式文档,跟踪组成员身份.每个嵌入文档都有一个指向另一个集合中的组的ID、一个开始日期和一个optional过期日期.
我想查询组中的当前成员."当前"表示开始时间小于当前时间,过期时间大于当前时间或为空.
This conditional query is totally blocking me up. I could do it by running two queries and merging the results, but that seems ugly and requires loading in all results at once. Or I could default the expire time to some arbitrary date in the far future, but that seems even uglier and potentially brittle. In SQL I'd just express it with "(expires >= Now()) OR (expires IS NULL)" -- but I don't know how to do that in Mongo.
有什么 idea 吗?非常感谢.