Menu

#32 ming 0.5.4 ignore 'if_missing' on subdocuments

open
nobody
None
2016-07-24
2016-07-24
No

I'm using Python 3.5.0.

class Example(MappedClass):
    class __mongometa__:
        ...

    _id = FieldProperty(schema.ObjectId)
    subdoc = FieldProperty(
        schema.Object({
            'date': FieldProperty(schema.DateTime(if_missing=datetime.now)),
            ...
        })
    )

Instead, this example works fine:

class Example(MappedClass):
    class __mongometa__:
        ...

    _id = FieldProperty(schema.ObjectId)
    date = FieldProperty(schema.DateTime(if_missing=datetime.now))

Discussion

Anonymous
Anonymous

Add attachments
Cancel