I am using flask-mongoengine extension and I have a User class like this:
class User(db.Document, UserMixin): email = db.StringField(max_length=120,
I don't know why but I was also keep getting the same error and only after downgrading pymongo from 3.0 to 2.8 it got fixed as David mentioned.
Pymongo should publish a fix for that, it is frustrating and made me waste couple of hours before realizing it.