Collation Locales and Default Parameters

New in version 3.4.

Collation allows users to specifylanguage-specific rules for string comparison, such as rules forlettercase and accent marks.

Behavior

Some collation locales have variants, which employ speciallanguage-specific rules. To specify a locale variant, use the followingsyntax:

  1. { "locale" : "<locale code>@collation=<variant>" }

For example, to use the pinyin variant of the Chinese collation:

  1. { "locale" : "zh@collation=pinyin" }

See the collation page for a fulldescription of collation behavior and syntax.

Supported Languages and Locales

MongoDB’s collation feature supportsthe following languages. Thefollowing table lists the supported languages and the associatedlocales as defined by ICU LocaleID. [1]

LanguageLocaleVariants
Afrikaansaf
Albaniansq
Amharicam
Arabicarcompat
Armenianhy
Assameseas
Azeriazsearch
Bengalibn
Belarusianbe
Bengalibntraditional
Bosnianbssearch
Bosnian (Cyrillic)bs_Cyrl
Bulgarianbg
Burmesemy
Catalancasearch
Cherokeechr
Chinesezhbig5hangb2312hanpinyinunihanzhuyin
Chinese (Traditional)zh_Hantstroke
Croatianhrsearch
Czechcssearch
Danishdasearch
Dutchnl
Dzongkhadz
Englishen
English (United States)en_US
English (United States, Computer)en_US_POSIX
Esperantoeo
Estonianet
Eweee
Faroesefo
Filipinofil
Finnishfi_FIsearchtraditional
Frenchfr
French (Canada)fr_CA
Galicianglsearch
Georgianka
Germandesearcheorphonebook
German (Austria)de_ATphonebook
Greekel
Gujaratigu
Hausaha
Hawaiianhaw
Hebrewhesearch
Hindihi
Hungarianhu
Icelandicissearch
Igboig
Inari Samismnsearch
Indonesianid
Irishga
Italianit
Japanesejaunihan

LanguageLocaleVariants
Kalaallisutklsearch
Kannadakntraditional
Kazakhkk
Khmerkm
Konkanikok
Koreankosearchsearchjlunihan
Kyrgyzky
Lakotalk
Laolo
Latvianlv
Lingalaliphonetic
Lithuanianlt
Lower Sorbiandsb
Luxembourgishlb
Macedonianmk
Malayms
Malayalamml
Maltesemt
Marathimr
Mongolianmn
Nepaline
Northern Samisesearch
Norwegian Bokmålnbsearch
Norwegian Nynorsknnsearch
Oriyaor
Oromoom
Pashtops
Persianfa
Persian (Afghanistan)fa_AF
Polishpl
Portuguesept
Punjabipa
Romanianro
Russianru
Serbiansr
Serbian (Latin)sr_Latnsearch
Sinhalasidictionary
Slovaksksearch
Sloveniansl
Spanishessearchtraditional
Swahilisw
Swedishsvsearch
Tamilta
Telugute
Thaith
Tibetanbo
Tonganto
Turkishtrsearch
Ukrainianuk
Upper Sorbianhsb
Urduur
Uyghurug
Vietnamesevitraditional
Walserwae
Welshcy
Yiddishyisearch
Yorubayo
Zuluzu

Tip

To explicitly specify simple binary comparison, specify localevalue of "simple".

[1]To request support for a locale, please file a JIRA ticket with theServer project

Collation Default Parameters

A collation document contains severaloptional parameters inaddition to the required locale parameter. Depending on whichlocale you use, the default parameters may be different.See the collation page for afull description of collation syntax.

The following default parameters are consistent across all locales:

  • caseLevel : false
  • strength : 3
  • numericOrdering : false
  • maxVariable : punct

The following table shows the default collation parameters which mayvary across different locales:

LocalecaseFirstalternatenormalizationbackwards
afoffnon-ignorableFALSEFALSE
sqoffnon-ignorableFALSEFALSE
amoffnon-ignorableFALSEFALSE
aroffnon-ignorableFALSEFALSE
ar@collation=compatoffnon-ignorableFALSEFALSE
hyoffnon-ignorableFALSEFALSE
asoffnon-ignorableTRUEFALSE
azoffnon-ignorableFALSEFALSE
az@collation=searchoffnon-ignorableTRUEFALSE
beoffnon-ignorableFALSEFALSE
bnoffnon-ignorableTRUEFALSE
bn@collation=traditionaloffnon-ignorableTRUEFALSE
bsoffnon-ignorableFALSEFALSE
bs@collation=searchoffnon-ignorableTRUEFALSE
bs_Cyrloffnon-ignorableFALSEFALSE
bgoffnon-ignorableFALSEFALSE
myoffnon-ignorableTRUEFALSE
caoffnon-ignorableFALSEFALSE
ca@collation=searchoffnon-ignorableTRUEFALSE
chroffnon-ignorableFALSEFALSE
zhoffnon-ignorableFALSEFALSE
zh@collation=big5hanoffnon-ignorableFALSEFALSE
zh@collation=gb2312hanoffnon-ignorableFALSEFALSE
zh@collation=unihanoffnon-ignorableFALSEFALSE
zh@collation=zhuyinoffnon-ignorableFALSEFALSE
zh_Hantoffnon-ignorableFALSEFALSE
hroffnon-ignorableFALSEFALSE
hr@collation=searchoffnon-ignorableTRUEFALSE
csoffnon-ignorableFALSEFALSE
cs@collation=searchoffnon-ignorableTRUEFALSE
dauppernon-ignorableFALSEFALSE
da@collation=searchoffnon-ignorableTRUEFALSE
nloffnon-ignorableFALSEFALSE
dzoffnon-ignorableFALSEFALSE
enoffnon-ignorableFALSEFALSE
en_US_POSIXoffnon-ignorableFALSEFALSE
en_USoffnon-ignorableFALSEFALSE
eooffnon-ignorableFALSEFALSE
etoffnon-ignorableFALSEFALSE
eeoffnon-ignorableFALSEFALSE
fooffnon-ignorableFALSEFALSE
fo@collation=searchoffnon-ignorableTRUEFALSE
filoffnon-ignorableFALSEFALSE
fioffnon-ignorableFALSEFALSE
fi@collation=searchoffnon-ignorableTRUEFALSE
fi@collation=traditionaloffnon-ignorableFALSEFALSE
froffnon-ignorableFALSEFALSE
fr_CAoffnon-ignorableFALSETRUE
gloffnon-ignorableFALSEFALSE
gl@collation=searchoffnon-ignorableTRUEFALSE
kaoffnon-ignorableFALSEFALSE
deoffnon-ignorableFALSEFALSE
de@collation=searchoffnon-ignorableTRUEFALSE
de@collation=phonebookoffnon-ignorableFALSEFALSE
de@collation=eoroffnon-ignorableFALSEFALSE
de_AToffnon-ignorableFALSEFALSE
de_AT@collation=phonebookoffnon-ignorableFALSEFALSE
eloffnon-ignorableTRUEFALSE
guoffnon-ignorableTRUEFALSE
haoffnon-ignorableFALSEFALSE
hawoffnon-ignorableFALSEFALSE
heoffnon-ignorableTRUEFALSE
he@collation=searchoffnon-ignorableTRUEFALSE
hioffnon-ignorableTRUEFALSE
huoffnon-ignorableFALSEFALSE
isoffnon-ignorableFALSEFALSE
is@collation=searchoffnon-ignorableTRUEFALSE
igoffnon-ignorableTRUEFALSE
smnoffnon-ignorableFALSEFALSE
smn@collation=searchoffnon-ignorableTRUEFALSE
idoffnon-ignorableFALSEFALSE
gaoffnon-ignorableFALSEFALSE
itoffnon-ignorableFALSEFALSE
jaoffnon-ignorableFALSEFALSE
ja@collation=unihanoffnon-ignorableFALSEFALSE
kloffnon-ignorableFALSEFALSE
kl@collation=searchoffnon-ignorableTRUEFALSE
knoffnon-ignorableTRUEFALSE
kn@collation=traditionaloffnon-ignorableTRUEFALSE
kkoffnon-ignorableFALSEFALSE
kmoffnon-ignorableTRUEFALSE
kokoffnon-ignorableTRUEFALSE
kooffnon-ignorableFALSEFALSE
ko@collation=searchoffnon-ignorableTRUEFALSE
ko@collation=searchjloffnon-ignorableTRUEFALSE
ko@collation=unihanoffnon-ignorableFALSEFALSE
kyoffnon-ignorableFALSEFALSE
lktoffnon-ignorableFALSEFALSE
looffnon-ignorableFALSEFALSE
lvoffnon-ignorableFALSEFALSE
lnoffnon-ignorableFALSEFALSE
ln@collation=phoneticoffnon-ignorableFALSEFALSE
ltoffnon-ignorableFALSEFALSE
dsboffnon-ignorableFALSEFALSE
lboffnon-ignorableFALSEFALSE
mkoffnon-ignorableFALSEFALSE
msoffnon-ignorableFALSEFALSE
mloffnon-ignorableFALSEFALSE
mtuppernon-ignorableFALSEFALSE
mroffnon-ignorableTRUEFALSE
mnoffnon-ignorableFALSEFALSE
neoffnon-ignorableFALSEFALSE
seoffnon-ignorableFALSEFALSE
se@collation=searchoffnon-ignorableTRUEFALSE
nboffnon-ignorableFALSEFALSE
nb@collation=searchoffnon-ignorableTRUEFALSE
nnoffnon-ignorableFALSEFALSE
nn@collation=searchoffnon-ignorableTRUEFALSE
oroffnon-ignorableTRUEFALSE
omoffnon-ignorableFALSEFALSE
psoffnon-ignorableTRUEFALSE
faoffnon-ignorableTRUEFALSE
fa_AFoffnon-ignorableTRUEFALSE
ploffnon-ignorableFALSEFALSE
ptoffnon-ignorableFALSEFALSE
paoffnon-ignorableTRUEFALSE
rooffnon-ignorableFALSEFALSE
ruoffnon-ignorableFALSEFALSE
sroffnon-ignorableFALSEFALSE
sr_Latnoffnon-ignorableFALSEFALSE
sr_Latn@collation=searchoffnon-ignorableTRUEFALSE
sioffnon-ignorableTRUEFALSE
si@collation=dictionaryoffnon-ignorableTRUEFALSE
skoffnon-ignorableFALSEFALSE
sk@collation=searchoffnon-ignorableTRUEFALSE
sloffnon-ignorableFALSEFALSE
esoffnon-ignorableFALSEFALSE
es@collation=searchoffnon-ignorableTRUEFALSE
es@collation=traditionaloffnon-ignorableFALSEFALSE
swoffnon-ignorableFALSEFALSE
svoffnon-ignorableFALSEFALSE
sv@collation=searchoffnon-ignorableTRUEFALSE
taoffnon-ignorableTRUEFALSE
teoffnon-ignorableTRUEFALSE
thoffshiftedTRUEFALSE
booffnon-ignorableFALSEFALSE
tooffnon-ignorableFALSEFALSE
troffnon-ignorableFALSEFALSE
tr@collation=searchoffnon-ignorableTRUEFALSE
ukoffnon-ignorableFALSEFALSE
hsboffnon-ignorableFALSEFALSE
uroffnon-ignorableFALSEFALSE
ugoffnon-ignorableFALSEFALSE
vioffnon-ignorableTRUEFALSE
vi@collation=traditionaloffnon-ignorableTRUEFALSE
waeoffnon-ignorableFALSEFALSE
cyoffnon-ignorableFALSEFALSE
yioffnon-ignorableTRUEFALSE
yi@collation=searchoffnon-ignorableTRUEFALSE
yooffnon-ignorableTRUEFALSE
zuoffnon-ignorableFALSEFALSE