public class Collation extends Object
Document that can be used for creating collections & indexes as well as
querying data.
NOTE: Please keep in mind that queries will only make use of an index with collation settings if the
query itself specifies the same collation.| Modifier and Type | Class and Description |
|---|---|
static class |
Collation.Alternate |
static class |
Collation.AlternateWithMaxVariable |
static class |
Collation.CaseFirst |
static class |
Collation.CollationLocale
ICU locale abstraction for usage with MongoDB
Collation. |
static interface |
Collation.ComparisonLevel
Abstraction for the ICU Comparison Levels.
|
static class |
Collation.PrimaryICUComparisonLevel
Primary-strength
ICUComparisonLevel. |
static class |
Collation.SecondaryICUComparisonLevel
Secondary-strength
ICUComparisonLevel. |
static class |
Collation.TertiaryICUComparisonLevel
Tertiary-strength
ICUComparisonLevel. |
| Modifier and Type | Method and Description |
|---|---|
Collation |
alternate(Collation.Alternate alternate)
Set the Field that determines whether collation should consider whitespace and punctuation as base characters for
purposes of comparison.
|
Collation |
alternate(String alternate)
Set the Field that determines whether collation should consider whitespace and punctuation as base characters for
purposes of comparison.
|
Collation |
backwardDiacriticSort()
Sort string with diacritics sort from back of the string.
|
Collation |
backwards(boolean backwards)
Set the flag that determines whether strings with diacritics sort from back of the string.
|
Collation |
caseFirst(Collation.CaseFirst sort)
Set the flag that determines sort order of case differences during tertiary level comparisons.
|
Collation |
caseFirst(String caseFirst)
Set the flag that determines sort order of case differences during tertiary level comparisons.
|
Collation |
caseLevel(boolean caseLevel)
Set whether to include
caseLevel comparison. |
Collation |
forwardDiacriticSort()
Do not sort string with diacritics sort from back of the string.
|
static Collation |
from(org.bson.Document source)
Create new
Collation from values in Document. |
<R> R |
map(Converter<? super Collation,? extends R> mapper)
|
Collation |
maxVariable(String maxVariable)
Set the field that determines up to which characters are considered ignorable when alternate is
shifted. |
Collation |
normalization(boolean normalization)
Set the flag that determines whether to check if text require normalization and to perform normalization.
|
Collation |
normalizationDisabled()
Disable text normalization.
|
Collation |
normalizationEnabled()
Enable text normalization.
|
Collation |
numericOrdering(boolean flag)
Set the flag that determines whether to compare numeric strings as numbers or as strings.
|
Collation |
numericOrderingDisabled()
Treat numeric strings as string for comparison.
|
Collation |
numericOrderingEnabled()
Treat numeric strings as numbers for comparison.
|
static Collation |
of(Collation.CollationLocale locale)
Create new
Collation with locale set to the given Collation.CollationLocale. |
static Collation |
of(Locale locale)
|
static Collation |
of(String language)
Create new
Collation with locale set to the given ICU language. |
static Collation |
simple()
Create a
Collation using simple binary comparison. |
Collation |
strength(Collation.ComparisonLevel comparisonLevel)
Set the level of comparison to perform.
|
Collation |
strength(int strength)
Set the level of comparison to perform.
|
org.bson.Document |
toDocument()
Get the
Document representation of the Collation. |
com.mongodb.client.model.Collation |
toMongoCollation()
Get the
Collation representation of the Collation. |
String |
toString() |
public static Collation simple()
Collation using simple binary comparison.Collation for simple binary comparison.public static Collation of(String language)
Collation with locale set to the given ICU language.language - must not be null.public static Collation of(Collation.CollationLocale locale)
Collation with locale set to the given Collation.CollationLocale.locale - must not be null.public static Collation from(org.bson.Document source)
Collation from values in Document.source - must not be null.public Collation strength(int strength)
strength - Collation.public Collation strength(Collation.ComparisonLevel comparisonLevel)
comparisonLevel - must not be null.Collationpublic Collation caseLevel(boolean caseLevel)
caseLevel comparison. caseLevel - Collation.public Collation caseFirst(String caseFirst)
caseFirst - must not be null.public Collation caseFirst(Collation.CaseFirst sort)
caseFirst - must not be null.public Collation numericOrderingEnabled()
Collation.public Collation numericOrderingDisabled()
Collation.public Collation numericOrdering(boolean flag)
Collation.public Collation alternate(String alternate)
alternate - must not be null.Collation.public Collation alternate(Collation.Alternate alternate)
alternate - must not be null.Collation.public Collation backwardDiacriticSort()
Collation.public Collation forwardDiacriticSort()
Collation.public Collation backwards(boolean backwards)
backwards - must not be null.Collation.public Collation normalizationEnabled()
Collation.public Collation normalizationDisabled()
Collation.public Collation normalization(boolean normalization)
normalization - must not be null.Collation.public Collation maxVariable(String maxVariable)
shifted.maxVariable - must not be null.Collation.public org.bson.Document toDocument()
Document representation of the Collation.public com.mongodb.client.model.Collation toMongoCollation()
Collation representation of the Collation.public <R> R map(Converter<? super Collation,? extends R> mapper)
R - mapper - Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.