Use custom collation to specify language-specific rules for string comparison, such as rules for letter case and accent marks, within your aggregation pipeline.使用自定义排序规则为聚合管道中的字符串比较指定特定于语言的规则,例如字母大小写和重音标记的规则。
About this Task关于此任务
When entering a collation document, the 输入排序规则文档时,locale field is mandatory. Default collation field values vary depending on which locale you specify. To learn more about supported languages and locales, see Collation Locales and Default Parameters.locale(区域设置)字段是必填的。默认排序规则字段值因指定的区域设置而异。要了解有关支持的语言和区域设置的更多信息,请参阅排序规则区域和默认参数。
Steps步骤
Click Options单击“选项”
In the top-right corner of the pipeline builder, click Options.在管道生成器的右上角,单击“选项”。

Enter your collation document输入排序规则文档
Next to the Collation field, enter your collation document.在“排序规则”字段旁边,输入排序规则文档。
After you enter your collation document, the aggregation pipeline builder considers the language-specific rules that you specified in your document.输入排序规则文档后,聚合管道生成器会考虑您在文档中指定的特定语言规则。
Example示例
The following sample collation document specifies French as the chosen 以下示例排序规则文档指定法语作为所选locale and sorts uppercase letters before lowercase letters with the caseFirst field:locale,并使用caseFirst字段对大写字母和小写字母进行排序:
{
locale: "fr",
caseFirst: "upper"
}