MongoDB Error Duplicate key
I sometimes get this error when authenticating with MongoDB:
It is because my id is saved under column
_id
not id
therefore all sessions have id null - duplicate.
How can I change which column is checked for ID? Because until now the only possible fix was to delete all sessions from table.7 Replies
are you using the mongodb adapter or prisma?
MongoDB adapter
There should be no
id
field. The monogodb adapter forces the _id
field.yes but for some reason better auth checks for id not _id in some cases
If you can track what endpoint or action is exactly triggering that, let me know. Will take a look.
hmm is it possible because of this?

when i authenticate with google it tries to create a new session in db with some _id and id set as null, but there is already a session in db existing with id null