Kit*_*itB 10 google-app-engine app-engine-ndb
是否有一种有效的机制来查询NDB中重复属性中的项目数量?
我想做点什么:
Class.query(class.repeated_property.count == 2)
Run Code Online (Sandbox Code Playgroud)
但当然这不起作用.
Gui*_*sum 25
具体来说,您可以使用ComputedProperty自动存储计数,例如
class X(ndb.Model):
prop = ndb.StringProperty(repeated=True)
prop_count = ndb.ComputedProperty(lambda e: len(e.prop))
X.query(X.prop_count == 2)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1710 次 |
最近记录: |