[Bug]: Using Cosmos DB: E11000 duplicate key error when new user attempts login or registration #1778
Replies: 5 comments 18 replies
-
Yeah this is a known issue for me. I might be able to remove the sparse field as I’m not sure it’s needed. Still need to investigate the effects of removing it. I’ve heard DocumentDB is a good enterprise level, cloud alternative (AWS) |
Beta Was this translation helpful? Give feedback.
-
Thanks Danny. Thinking of dropping Cosmos and either containerizing Mongo as prescribed or using Atlas. Most of my clients are big Azure shops, hence my first attempt at an Azure-first approach. Painful so far but it's working. About to deploy the assistants branch to Azure... |
Beta Was this translation helpful? Give feedback.
-
thanks @rubentalstra. switched to vcore but this gives me: while there is nothing in the db: are you using the vcore model as well? |
Beta Was this translation helpful? Give feedback.
-
@gijs-voogd https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/vcore/quickstart-portal |
Beta Was this translation helpful? Give feedback.
-
Dropping indices on |
Beta Was this translation helpful? Give feedback.
-
What happened?
Using Azure Cosmos DB as backend, which (poorly) emulates Mongo DB, and as a result have encountered a number of issues. This one is due to unique indexes being created in the users collection for each of the "social login" options (facebookId, etc.).
Apparently Cosmos DB doesn't support sparse unique indexes, i.e. treats multiple NULL values as duplicates. I am using OpenID only, so manually deleting the other indexes in the collection solved the issue.
Not looking for a fix here per se, as I'm beginning to realize that Cosmos DB should be consider a semi-supported choice given it's API emulation. Adding detail for others who might try the same, and perhaps for those who might have ideas to better support both Cosmos and Mongo.
Steps to Reproduce
What browsers are you seeing the problem on?
No response
Relevant log output
Screenshots
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions