Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmos-DB compatability #25

Merged
merged 2 commits into from
Jun 30, 2023
Merged

Cosmos-DB compatability #25

merged 2 commits into from
Jun 30, 2023

Conversation

jthurner
Copy link
Collaborator

Azure Cosmos DB for MongoDB neither supports creating unique index on non-empty collections nor collation, which leads to exceptions in fastapi-users.

Introduce a setting COSMOSDB_COMPAT which, when set, replaces MongoDBUserDatabase with a subclass with the incompatible function calls patched out:

  • only set indexes if they do not exist on the collection (so they are set only once, before documents are inserted)
  • do not use collation when storing/querying the email field

Skipping the collation means that email addressess (usernames) are not case-insensitive anymore - i.e. my@user.de and My@user.de are treated as different accounts.

@jthurner jthurner changed the base branch from master to develop June 30, 2023 09:31
@jthurner jthurner merged commit f40324e into develop Jun 30, 2023
0 of 4 checks passed
@jthurner jthurner deleted the cosmosdb_compat branch July 5, 2023 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant