MongoKit Nested Structure Save Error

43 views
Skip to first unread message

deng....@gmail.com

unread,
Feb 26, 2014, 1:46:37 PM2/26/14
to mong...@googlegroups.com
 

Based on the MongoKit documentation, I define a nested structure 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 is:

bson.errors.InvalidDocument: Cannot encode object: {'start': 'M', 'payment': 'M'}

Reply all
Reply to author
Forward
0 new messages