Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Jokes
Docs Menu
Docs Home
/ / /

Specify Custom Collation For Your Pipeline

Use custom collation to specify language-specific rules for string comparison, such as rules for letter case and accent marks, within your aggregation pipeline.

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.

1
  1. If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your project from the Projects menu in the navigation bar.

  3. In the sidebar, click Data Explorer under the Database heading.

    The Data Explorer displays.

Note

You can also go to the Clusters page, and click Data Explorer under the Shortcuts heading.

2
  1. Select the collection.

  2. In the top-right corner of the pipeline builder, click Options.

More Options
3

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.

The following sample collation document specifies French as the chosen locale and sorts uppercase letters before lowercase letters with the caseFirst field:

{
locale: "fr",
caseFirst: "upper"
}

Back

Count Results

On this page