All we need is an easy explanation of the problem, so here it is.
From my understanding, MongoDB uses a B+ Tree for indexes, including for unique fields such as emails and usernames.
However, I don’t understand how a string value such as an email or username gets converted to a numeric format (that can be sorted with ascending, descending).
Can anyone help me understand? Are the string values getting converted to numbers? How is a B+ Tree done per character?
Any examples or resources to read on would be great. (I am trying to implement some kind of B+ Tree that can support indexing of usernames
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
Back to answer my own question:
Apparently, you can just compare strings using greater than & less than operators, which I was unaware of.
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂