According to the MongoDB documentation and the ICU documentation it should be possible to ignore full-width and half-width difference in Japanese text by utilizing collation
.
I tried the following;
{ locale: "ja", caseLevel:true, strength:1}
with different strength but none of them is working.
db.getCollection('mycollection')
.find({"desc":/バンド/})
.collation({ locale: "ja", caseLevel:true, strength:1})
This query cannot get result from the following document;
{
"desc": "*EGRパイプバンド外れ"
}
update
Found reason that in MongoDB regex cannot apply collation, so if I use certain match to perform query the result is perfect:
db.getCollection('mycollection')
.find({"desc":"*EGRパイプバンド外れ???"})
.collation({ locale: "ja", caseLevel:true, strength:1})
This query will return *EGRパイプバンド外れ
this result.
But not if I use regex, any suggestion on it?