简体   繁体   中英

Mongokit How do I specify a key in a dict which is in a list as a required field?

I'm using mongokit and I have a structure similar to this in my document.

class MyDoc(Document):
    structure = {
        'sections': [{
            'title': unicode,
            'description': unicode
        }]
    }

    required_fields = []

I want to make description a required field in this document. I know nested keys can be accessed via the dot notation, but sections.description does not work. How do I achieve what I want?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM