我有一个mongoalchemy模型:
class ImportProductReport(mongo.Document):
target = mongo.IntField(default=0)
processed = mongo.IntField(default=0)
is_in_process_remove_offers = mongo.BoolField(default=False)
is_old_offers_removed = mongo.BoolField(default=False)
...
我需要获取记录,在哪里
ImportProductReport.is_in_process_remove_offers == 假,
ImportProductReport.is_old_offers_removed == 假,
ImportProductReport.target == ImportProductReport.processed。
没有最后一个平等,一切都很好:
res = ImportProductReport.query\
.filter(
ImportProductReport.is_old_offers_removed == False,
ImportProductReport.is_in_process_remove_offers == False
)\
.all()
但是如果我尝试写这样的东西:
res = ImportProductReport.query\
.filter(
ImportProductReport.is_old_offers_removed == False,
ImportProductReport.is_in_process_remove_offers == False,
ImportProductReport.target == ImportProductReport.processed
)\
.all()
我有一个错误:
AttributeError: 'bool' object has no attribute 'obj'
请告诉我,如何在我的查询中添加最后一个条件?:)