Specifying keys in embedded doc in list as required.

20 views
Skip to first unread message

Edward Ootake

unread,
Feb 7, 2015, 5:32:08 AM2/7/15
to mong...@googlegroups.com

Lets' say I have a following structure.

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

    required_fields = []

How do I specify description as a require field? sections.description or sections.$.description does not work.

I asked the same question here, but I was a bit surprised this feature is not supported.

This seems to be such a common scenario. I could potentially extract embedded docs out to a separate collection, but that defeats the purpose of choosing MongoDB for me because I was looking to have everything (which isn't a lot) under one document and avoid multiple queries.

Reply all
Reply to author
Forward
0 new messages