namlook/mongokit — Issue #70: adding missing values with use_dot_notation fails
Author: matejcik
Created: 2011-12-20 14:09:18+00:00
State: open

```python
class User(Document):
__collection__ = 'users'
structure = {
'name': unicode,
'password': unicode,
'description': unicode,
}
use_dot_notation = True

user = some_function_that_fetches_user()
user.description = 'new description'
user.save()
```

This fails when the fetched `user` object does not have a `description` field. Documentation says "Note that if an attribute is not in structure, the value will be added as attribute". In this case, however, the attribute is in structure but not in the record itself.