拥有这 2 个 MongoEngine 文档:
class A(Document):
a = StringField()
class B(Document):
b = StringField()
boolfield = BooleanField(default=False)
ref = ReferenceField(A)
我想首先filter()
在一个特定的 A 对象上,然后从第一个查询开始,filter()
在 BooleanField 上。但是这些行会导致错误:
a_objects = A.objects(a='test') # OK
query = B.objects(ref__in=a_objects) # OK
query2 = query.filter(boolfield=True) # FAILS
错误是:
TypeError: 'Collection' object is not callable. If you meant to call the '__deepcopy__' method on a 'Collection' object it is failing because no such method exists.
在此处查看完整代码和回溯:https ://gist.github.com/nferrari/4962245
谢谢!