I forked the Flask example, Minitwit, to work with MongoDB and it was working fine on Flask 0.9, but after upgrading to 0.10.1 I get the error in title when I login when I try t
toString converts it to the string and that can stored to session:
toString
session['_id'] = user['_id'].toString()
alternative session['_id'] = str(user['_id'])
session['_id'] = str(user['_id'])
The above fixed the error for me.