Home > front end >  using mongodb for flask session without proper index causes session update failure
using mongodb for flask session without proper index causes session update failure

Time:04-09

If there are no index, session update doesn't seem to work and login fails. After setting index for id field, everything works fine. I wonder is this because response ended the thread and killed the mongo connnection?

CodePudding user response:

I had a similar error when Sessions tried to update mongo.

line 456, in save_session
    self.store.update({'id': store_id},

Turns out it was because the update method it was calling doesn't exist after pymongo v4.0. I downgraded with

pip install pymongo:3.12.3

And now I have sessions stored in mongo :)

CodePudding user response:

Turns out ther is a race condition.

  • Related