Docs 菜单

Docs 主页开发应用程序MongoDB Manual

排序规则区域设置和默认参数

在此页面上

  • 行为
  • 支持的语言和区域设置
  • 排序规则默认参数

版本 3.4 中的新增功能

排序规则允许用户为字符串比较指定特定于语言的规则,例如字母大小写和重音符号规则。

某些排序规则语言环境会有一些变体,这些变体采用特定于语言的特殊规则。若要指定语言环境变体,请使用以下语法:

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

例如,如要使用中文排序规则的unihan 变体:

{ "locale" : "zh@collation=unihan" }

有关排序规则行为和语法的完整说明,请参阅排序规则页面

MongoDB 排序规则功能 支持以下语言。下表列出了支持的语言以及 ICU 区域设置 ID 定义的关联区域设置 。 [1 ]

语言
locale
变体
南非荷兰语
af
阿尔巴尼亚语
sq
阿姆哈拉语
am
阿拉伯语
ar
compat
亚美尼亚语
hy
阿萨姆语
as
阿塞拜疆语
az
search
孟加拉语
bn
白俄罗斯语
be
孟加拉语
bn
traditional
波斯尼亚语
bs
search
波斯尼亚文(西里尔文)
bs_Cyrl
保加利亚语
bg
缅文
my
加泰罗尼亚语
ca
search
切罗基语
chr
汉语
zh
big5han
gb2312han
unihan
zhuyin
中文(繁体)
zh_Hant
克罗地亚文
hr
search
捷克语
cs
search
丹麦文
da
search
荷兰语
nl
宗卡语
dz
英语
en
英语(美国)
en_US
英语(美国,计算机)
en_US_POSIX
世界语
eo
爱沙尼亚语
et
埃维语
ee
法罗群岛语
fo
菲律宾语
fil
芬兰语
fi
search
traditional
法国
fr
法语(加拿大)
fr_CA
加利西亚语
gl
search
格鲁吉亚语
ka
德语
de
search
eor
phonebook
德语(奥地利)
de_AT
phonebook
希腊语
el
古吉拉特语
gu
豪萨语
ha
夏威夷语
haw
希伯来语
he
search
印地文
hi
匈牙利语
hu
冰岛文
is
search
伊博语
ig
伊纳里萨米语
smn
search
印度尼西亚语
id
爱尔兰语
ga
意大利
it
日语
ja
unihan
语言
locale
变体
格陵兰语
kl
search
Kannada
kn
traditional
哈萨克语
kk
高棉语
km
孔卡尼语
kok
韩语
ko
search
searchjl
unihan
吉尔吉斯斯坦语
ky
拉科塔语
lkt
老挝语
lo
拉脱维亚语
lv
林加拉语
ln
phonetic
立陶宛语
lt
下索布语
dsb
卢森堡语
lb
马其顿语
mk
马来文
ms
马拉雅拉姆语
ml
马耳他语
mt
马拉地语
mr
蒙古语
mn
尼泊尔语
ne
北萨米语
se
search
挪威博克马尔语
nb
search
挪威新诺斯克语
nn
search
奥里雅语
or
奥罗莫语
om
普什图语
ps
波斯语
fa
波斯语(阿富汗)
fa_AF
波兰文
pl
葡萄牙文
pt
旁遮普语
pa
罗马尼亚语
ro
俄语
ru
塞尔维亚语
sr
塞尔维亚语(拉丁)
sr_Latn
search
僧伽罗语
si
dictionary
斯洛伐克语
sk
search
斯洛文尼亚语
sl
西班牙语
es
search
traditional
斯瓦希里语
sw
瑞典语
sv
search
泰米尔文
ta
泰卢固语
te
泰语
th
藏语
bo
汤加语
to
土耳其文
tr
search
乌克兰语
uk
上索布语
hsb
乌尔都语
ur
维吾尔文
ug
越南文
vi
traditional
瓦尔瑟语
wae
威尔士语
cy
意第绪文
yi
search
约鲁巴语
yo
祖鲁语
zu

提示

要明确指定简单的二进制比较,请将 locale 的值指定为 "simple"

[1] 要请求对区域设置的支持,请向 服务器项目 提交 JIRA 票证

排序规则文档包含多个可选参数以及必填的 locale 参数。根据您使用的 locale,默认参数可能会有所不同。请参阅排序规则页面,获取排序规则语法的完整说明。

以下默认参数对于所有区域设置都是一致的:

  • caseLevel : false

  • strength : 3

  • numericOrdering : false

  • maxVariable : punct

下表显示默认排序规则参数,这些参数可能因区域设置而异:

locale
caseFirst
替代方案
normalization
backwards
af
off
non-ignorable
FALSE
FALSE
sq
off
non-ignorable
FALSE
FALSE
am
off
non-ignorable
FALSE
FALSE
ar
off
non-ignorable
FALSE
FALSE
ar@collation=compat
off
non-ignorable
FALSE
FALSE
hy
off
non-ignorable
FALSE
FALSE
as
off
non-ignorable
TRUE
FALSE
az
off
non-ignorable
FALSE
FALSE
az@collation=search
off
non-ignorable
TRUE
FALSE
be
off
non-ignorable
FALSE
FALSE
bn
off
non-ignorable
TRUE
FALSE
bn@collation=traditional
off
non-ignorable
TRUE
FALSE
bs
off
non-ignorable
FALSE
FALSE
bs@collation=search
off
non-ignorable
TRUE
FALSE
bs_Cyrl
off
non-ignorable
FALSE
FALSE
bg
off
non-ignorable
FALSE
FALSE
my
off
non-ignorable
TRUE
FALSE
ca
off
non-ignorable
FALSE
FALSE
ca@collation=search
off
non-ignorable
TRUE
FALSE
chr
off
non-ignorable
FALSE
FALSE
zh
off
non-ignorable
FALSE
FALSE
zh@collation=big5han
off
non-ignorable
FALSE
FALSE
zh@collation=gb2312han
off
non-ignorable
FALSE
FALSE
zh@collation=unihan
off
non-ignorable
FALSE
FALSE
zh@collation=zhuyin
off
non-ignorable
FALSE
FALSE
zh_Hant
off
non-ignorable
FALSE
FALSE
hr
off
non-ignorable
FALSE
FALSE
hr@collation=search
off
non-ignorable
TRUE
FALSE
cs
off
non-ignorable
FALSE
FALSE
cs@collation=search
off
non-ignorable
TRUE
FALSE
da
upper
non-ignorable
FALSE
FALSE
da@collation=search
off
non-ignorable
TRUE
FALSE
nl
off
non-ignorable
FALSE
FALSE
dz
off
non-ignorable
FALSE
FALSE
en
off
non-ignorable
FALSE
FALSE
en_US_POSIX
off
non-ignorable
FALSE
FALSE
en_US
off
non-ignorable
FALSE
FALSE
eo
off
non-ignorable
FALSE
FALSE
et
off
non-ignorable
FALSE
FALSE
ee
off
non-ignorable
FALSE
FALSE
fo
off
non-ignorable
FALSE
FALSE
fo@collation=search
off
non-ignorable
TRUE
FALSE
fil
off
non-ignorable
FALSE
FALSE
fi
off
non-ignorable
FALSE
FALSE
fi@collation=search
off
non-ignorable
TRUE
FALSE
fi@collation=traditional
off
non-ignorable
FALSE
FALSE
fr
off
non-ignorable
FALSE
FALSE
fr_CA
off
non-ignorable
FALSE
TRUE
gl
off
non-ignorable
FALSE
FALSE
gl@collation=search
off
non-ignorable
TRUE
FALSE
ka
off
non-ignorable
FALSE
FALSE
de
off
non-ignorable
FALSE
FALSE
de@collation=search
off
non-ignorable
TRUE
FALSE
de@collation=phonebook
off
non-ignorable
FALSE
FALSE
de@collation=eor
off
non-ignorable
FALSE
FALSE
de_AT
off
non-ignorable
FALSE
FALSE
de_AT@collation=phonebook
off
non-ignorable
FALSE
FALSE
el
off
non-ignorable
TRUE
FALSE
gu
off
non-ignorable
TRUE
FALSE
ha
off
non-ignorable
FALSE
FALSE
haw
off
non-ignorable
FALSE
FALSE
he
off
non-ignorable
TRUE
FALSE
he@collation=search
off
non-ignorable
TRUE
FALSE
hi
off
non-ignorable
TRUE
FALSE
hu
off
non-ignorable
FALSE
FALSE
is
off
non-ignorable
FALSE
FALSE
is@collation=search
off
non-ignorable
TRUE
FALSE
ig
off
non-ignorable
TRUE
FALSE
smn
off
non-ignorable
FALSE
FALSE
smn@collation=search
off
non-ignorable
TRUE
FALSE
id
off
non-ignorable
FALSE
FALSE
ga
off
non-ignorable
FALSE
FALSE
it
off
non-ignorable
FALSE
FALSE
ja
off
non-ignorable
FALSE
FALSE
ja@collation=unihan
off
non-ignorable
FALSE
FALSE
kl
off
non-ignorable
FALSE
FALSE
kl@collation=search
off
non-ignorable
TRUE
FALSE
kn
off
non-ignorable
TRUE
FALSE
kn@collation=traditional
off
non-ignorable
TRUE
FALSE
kk
off
non-ignorable
FALSE
FALSE
km
off
non-ignorable
TRUE
FALSE
kok
off
non-ignorable
TRUE
FALSE
ko
off
non-ignorable
FALSE
FALSE
ko@collation=search
off
non-ignorable
TRUE
FALSE
ko@collation=searchjl
off
non-ignorable
TRUE
FALSE
ko@collation=unihan
off
non-ignorable
FALSE
FALSE
ky
off
non-ignorable
FALSE
FALSE
lkt
off
non-ignorable
FALSE
FALSE
lo
off
non-ignorable
FALSE
FALSE
lv
off
non-ignorable
FALSE
FALSE
ln
off
non-ignorable
FALSE
FALSE
ln@collation=phonetic
off
non-ignorable
FALSE
FALSE
lt
off
non-ignorable
FALSE
FALSE
dsb
off
non-ignorable
FALSE
FALSE
lb
off
non-ignorable
FALSE
FALSE
mk
off
non-ignorable
FALSE
FALSE
ms
off
non-ignorable
FALSE
FALSE
ml
off
non-ignorable
FALSE
FALSE
mt
upper
non-ignorable
FALSE
FALSE
mr
off
non-ignorable
TRUE
FALSE
mn
off
non-ignorable
FALSE
FALSE
ne
off
non-ignorable
FALSE
FALSE
se
off
non-ignorable
FALSE
FALSE
se@collation=search
off
non-ignorable
TRUE
FALSE
nb
off
non-ignorable
FALSE
FALSE
nb@collation=search
off
non-ignorable
TRUE
FALSE
nn
off
non-ignorable
FALSE
FALSE
nn@collation=search
off
non-ignorable
TRUE
FALSE
or
off
non-ignorable
TRUE
FALSE
om
off
non-ignorable
FALSE
FALSE
ps
off
non-ignorable
TRUE
FALSE
fa
off
non-ignorable
TRUE
FALSE
fa_AF
off
non-ignorable
TRUE
FALSE
pl
off
non-ignorable
FALSE
FALSE
pt
off
non-ignorable
FALSE
FALSE
pa
off
non-ignorable
TRUE
FALSE
ro
off
non-ignorable
FALSE
FALSE
ru
off
non-ignorable
FALSE
FALSE
sr
off
non-ignorable
FALSE
FALSE
sr_Latn
off
non-ignorable
FALSE
FALSE
sr_Latn@collation=search
off
non-ignorable
TRUE
FALSE
si
off
non-ignorable
TRUE
FALSE
si@collation=dictionary
off
non-ignorable
TRUE
FALSE
sk
off
non-ignorable
FALSE
FALSE
sk@collation=search
off
non-ignorable
TRUE
FALSE
sl
off
non-ignorable
FALSE
FALSE
es
off
non-ignorable
FALSE
FALSE
es@collation=search
off
non-ignorable
TRUE
FALSE
es@collation=traditional
off
non-ignorable
FALSE
FALSE
sw
off
non-ignorable
FALSE
FALSE
sv
off
non-ignorable
FALSE
FALSE
sv@collation=search
off
non-ignorable
TRUE
FALSE
ta
off
non-ignorable
TRUE
FALSE
te
off
non-ignorable
TRUE
FALSE
th
off
shifted
TRUE
FALSE
bo
off
non-ignorable
FALSE
FALSE
to
off
non-ignorable
FALSE
FALSE
tr
off
non-ignorable
FALSE
FALSE
tr@collation=search
off
non-ignorable
TRUE
FALSE
uk
off
non-ignorable
FALSE
FALSE
hsb
off
non-ignorable
FALSE
FALSE
ur
off
non-ignorable
FALSE
FALSE
ug
off
non-ignorable
FALSE
FALSE
vi
off
non-ignorable
TRUE
FALSE
vi@collation=traditional
off
non-ignorable
TRUE
FALSE
wae
off
non-ignorable
FALSE
FALSE
cy
off
non-ignorable
FALSE
FALSE
yi
off
non-ignorable
TRUE
FALSE
yi@collation=search
off
non-ignorable
TRUE
FALSE
yo
off
non-ignorable
TRUE
FALSE
zu
off
non-ignorable
FALSE
FALSE
← 排序规则