Вот мой класс:
class Presentation(db.Document):
title = db.StringField(max_length=120, required=True)
author = db.StringField (required=True)
pages = db.DocumentField(Page, required=False)
tags = db.StringField(max_length=120, required=False)
id = db.IntField(required=True)
currentPage = db.IntField()
def __str__(self):
return 'Title:%s author:%s id:%d currentPage:%d' % ( self.title, self.author,self.id,self.currentPage)
Когда я использую его из оболочки Монго, все выглядит нормально:
db.Presentation.find ({ID: 2})
{ "_id" : ObjectId("4e9cdddd0ad5c97ee6000000"),
"author" : "admin", "currentPage" : 3, "id" : 2,
"pages" : { "content" : "", "pagenum" : 0 }, "title" : "dd" }
но когда я использую MongoAlchemy,
p = query.filter (Presentation.id == 2) .first ()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.7-intel/egg/mongoalchemy/query.py", line 136, in first
File "build/bdist.macosx-10.7-intel/egg/mongoalchemy/query.py", line 388, in next
File "build/bdist.macosx-10.7-intel/egg/mongoalchemy/document.py", line 318, in unwrap
File "build/bdist.macosx-10.7-intel/egg/mongoalchemy/document.py", line 152, in __init__
mongoalchemy.exceptions.ExtraValueException: currentPage