• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Flask Mongoengine how to check unique field case insensitive

Resolved: Flask Mongoengine how to check unique field case insensitive

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have googled and googled for an answer, but I can’t seem to find one.
How do I make mongoengine check for a unique value in a case insensitive way? Because right now if I create an entry with, let’s say, ‘test@test.com’, it lets me create a new entry with ‘TEST@TEST.com”. How do I solve this issue, in a clean way? (Not using .lower)
models.py:
auth.py:

Answer:

You can make the unique index on the email field to be case insensitive by declaring the index specification in the meta dictionary.

If you have better answer, please add a comment about this, thank you!

flask mongoengine python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Use Svelte Component as Slot

26/03/2023

Resolved: Vaadin 14.9 – Redirect on Session Destroy Event

26/03/2023

Resolved: How to separate multiple answers in one column, for multiple columns, by creating extra columns

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.