something lik Server.db.Users = Pymongo.Connection(****).dbName.colName
This is fine:
>>> a = Server.db.Users.find_one({}, as_class=KeepDict)
>>>
This is not fine:
>>> b = Server.db.Users.find_and_modify(query={},update={'$set':{'bogus':True}},as_class=KeepDict)
/usr/local/lib/python2.7/dist-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/cursor.py:666: RuntimeWarning: couldn't encode - reloading python modules and trying again. if you see this without getting an InvalidDocument exception please see http://api.mongodb.org/python/current/faq.html#does-pymongo-work-with-mod-wsgi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-x86_64/egg/pymongo/collection.py", line 1202, in find_and_modify
File "build/bdist.linux-x86_64/egg/pymongo/database.py", line 348, in command
File "build/bdist.linux-x86_64/egg/pymongo/collection.py", line 520, in find_one
File "build/bdist.linux-x86_64/egg/pymongo/cursor.py", line 703, in next
File "build/bdist.linux-x86_64/egg/pymongo/cursor.py", line 666, in _refresh
bson.errors.InvalidDocument: Cannot encode object: <class 'keep.Types.KeepDict'>
>>>
Weirdly, this is also not ok:
>>> b = Server.db.Users.find_and_modify(query={},update={'$set':{'bogus':True}},as_class=dict)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-x86_64/egg/pymongo/collection.py", line 1202, in find_and_modify
File "build/bdist.linux-x86_64/egg/pymongo/database.py", line 348, in command
File "build/bdist.linux-x86_64/egg/pymongo/collection.py", line 520, in find_one
File "build/bdist.linux-x86_64/egg/pymongo/cursor.py", line 703, in next
File "build/bdist.linux-x86_64/egg/pymongo/cursor.py", line 666, in _refresh
bson.errors.InvalidDocument: Cannot encode object: <type 'dict'>
>>>