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:
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!