MongoKit Nested Structure Save Error

117 Views Asked by At

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'}

1

There are 1 best solutions below

1
Feng Deng On

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