Mongoengine使用或扩展聚合查询

2024-06-26 08:42:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我通过mongoengine进行聚合查询:

Foo.objects.aggregate(*[ { "$match": { "groups.1": { "$exists": True } } }, { "$redact": { "$cond": [ { "$gte": [ { "$size": { "$setIntersection": [ "$groups", my_groups ] } }, 1 ]}, "$$KEEP", "$$PRUNE" ] }} ])

但是,查询的结果是不够的。 我需要查找与此查询匹配的所有文档OR其他查询。在

我该怎么做? 谢谢您!在


Tags: truesizeobjectsfoomymatchexistsmongoengine