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

Unable to make User collection indexes unique #118

Open
martin-masse opened this issue Jan 5, 2022 · 0 comments
Open

Unable to make User collection indexes unique #118

martin-masse opened this issue Jan 5, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request investigation

Comments

@martin-masse
Copy link

Hi,

I was looking at making the index on NormalizedEmail and NormalizedUserName unique. It does not seems to be possible.

I can't override this behavior by registering my own IUserStore<> that inherit from AspNetCore.Identity.Mongo.Stores.UserStore. It is not possible since EnsureIndex is called in the UserStore constructor and it will always be called.

I have considered adding another index but MongoDb is complaining that another one already exists for the same column.

The possibilities I see here is to either

  • Change EnsureIndex to create unique Index (this could be a config option)
  • Provide an empty constructor on AspNetCore.Identity.Mongo.Stores.UserStore so we can provide our own implementation that inherit from it and initialize it the way we want.

Let me know if there are a way to do this

Thanks

@vova3211 vova3211 self-assigned this Feb 22, 2022
@vova3211 vova3211 added enhancement New feature or request investigation labels Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request investigation
Projects
None yet
Development

No branches or pull requests

2 participants