Error: Failed to create/update user: Plan executor error during findAndModify :: caused by :: E11000 duplicate key error collection: test.users index: userName_1 dup key: { userName: null }
Mishael-Joe opened this issue · comments
can i resolve this issue
I tried changing updateUser
method from user actions and trying to find any mistakes in AccountProfile
, but what solved my problem was deleting the collections from mongodb. (You can also delete the users from clerk in order to reuse your email)
In my case I had my mongoose user schema variable set as userName instead of all lowercase username. I decided to change it half way to username but because the db already had a user collection with userName, it was not allowing me to create / update. Hopefully this will help any of those who encounter this error.
Thanks 👍