Answer the question
In order to leave comments, you need to log in
Why am I getting a uniqueness violation issue in MongoDB?
There was a 1-in-1 situation like here - https://stackoverflow.com/questions/41499611/mongo...
What did the person in the comments mean when he wrote that he found the solution:
do not use one index but two indexes
One for text index, one for name only
Answer the question
In order to leave comments, you need to log in
Because MongoDB, when building a text index, breaks the string into words, then removes the so-called stop words and can normalize them.
Let's say you have the following 2 documents.
{text: "Два красивых яблока" }
{text: "Много яблок" }
"Два красивых яблока" → ["Два", "красивых", "яблока"]
"Много яблок" → ["Много", "яблок"]
["Два", "красивых", "яблока"] → ["два", "красивый", "яблоко"]
["Много", "яблок"] → ["много", "яблоко"]
["два", "красивый", "яблоко"] → [1, 2, 3], и словарь [1↔"два", 2↔"красивый", 3↔"яблоко"]
["много", "яблоко"] → [4, 3], и в словарь [1↔"два", 2↔"красивый", 3↔"яблоко", 4↔"много"]
[1→1, 2→1, 3→1]
[4→2, 3→2]
1→1,
2→1,
3→1,
4→2
3→2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question