mongokit icon indicating copy to clipboard operation
mongokit copied to clipboard

`Document` init from dict should update from `default_values` first

Open YiuTerran opened this issue 11 years ago • 0 comments

When specified doc for Document, i found the generated object not has default_values if the doc not have. For example:

class MyDoc(Document):
    structure={
        'name': unicode,
        'phone': basestring
    }
    default_values = {
         'phone': ''
   }

Then t=MyDoc({'name': 'xxx'}) will generate a dict not include default phone at all.

I think there should be a para like set_default=True to include all default values... It is convenient for create model from POST data.

YiuTerran avatar Apr 09 '15 09:04 YiuTerran