如何验证我的 desc 字段是必需的,而我的类别字段是可选的?
class Mydoc(Document):
structure = {
"name": unicode,
"items": [{
"category": int,
"desc": unicode
}]
}
required_fields = ["name", "items", "items.desc"] # Error: items has no attribute
# desc, it is a list not a dict.
如何验证列表中的类别?
更新
https://groups.google.com/forum/?fromgroups=#!topic/mongokit/GP5AgaMG6T4