简体   繁体   中英

MongoKit Nested Structure Save Error

Based on the MongoKit documentation, I define a nested sturcture use dictionary. But when saving the object, I got an error. Details are as below. Can you please kindly advise? Thanks

class Swap(Document):
      structure = {
          'coupon': float
          'start': int,
          'end': int,
          'bdc': {
              'start': basestring,
              'payment': basestring
          }
      }

And the error I got are: bson.errors.InvalidDocument: Cannot encode object: {'start': 'M', 'payment': 'M'}

Just to follow up on this. This error only happens when I turn on "use_dot_notation = True". I noticed there was a post wrt the same issue back in Jun 2013, and also has no response. So I will turn this flag off for now.

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