如何使用运算符$存在于使用MongoEngine语法的$elemMatch中

2024-06-06 21:08:28 发布

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

是否可以使用MongoEngine在$elemMatch中使用$exists运算符?在

我想做些类似的事情:

Location.objects(accessPoints__match={'deletedAt__exists': True, 'mac': "AC-86-74-xx-xx-xx"})

我认为MongoEngine假设deletedAt_uexists是我文档中属性的名称。在

但我发现唯一可行的方法是组合语法:

^{pr2}$

结合了MongoEngine语法和纯MongoDB语法。在


Tags: trueobjectsmacmatchexists语法运算符location