struct Mongo::Collation
- Mongo::Collation
- Struct
- Value
- Object
Overview
Collation allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks.
See: the official documentation
Included Modules
- BSON::Serializable
Defined in:
cryomongo/collation.crConstructors
-
.new(bson : BSON)
Allocate an instance and copies data from a BSON struct.
-
.new(locale : String, case_level : Bool? = nil, case_first : String? = nil, strength : Int32? = nil, numeric_ordering = nil, alternate = nil, max_variable = nil, backwards = nil, normalization = nil)
Create a new
Collation
instance.
Class Method Summary
-
.from_bson(bson : BSON)
NOTE See
self.new
.
Instance Method Summary
-
#alternate : String?
Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.
-
#alternate=(alternate : String?)
Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.
-
#backwards : Bool?
Flag that determines whether strings with diacritics sort from back of the string, such as with some French dictionary ordering.
-
#backwards=(backwards : Bool?)
Flag that determines whether strings with diacritics sort from back of the string, such as with some French dictionary ordering.
-
#case_first : String?
A field that determines sort order of case differences during tertiary level comparisons.
-
#case_first=(case_first : String?)
A field that determines sort order of case differences during tertiary level comparisons.
-
#case_level : Bool?
Flag that determines whether to include case comparison at strength level 1 or 2.
-
#case_level=(case_level : Bool?)
Flag that determines whether to include case comparison at strength level 1 or 2.
-
#locale : String
The ICU locale.
-
#locale=(locale : String)
The ICU locale.
-
#max_variable : String?
Field that determines up to which characters are considered ignorable when
alternate: "shifted"
. -
#max_variable=(max_variable : String?)
Field that determines up to which characters are considered ignorable when
alternate: "shifted"
. -
#normalization : Bool?
Flag that determines whether to check if text require normalization and to perform normalization.
-
#normalization=(normalization : Bool?)
Flag that determines whether to check if text require normalization and to perform normalization.
-
#numeric_ordering : Bool?
Flag that determines whether to compare numeric strings as numbers or as strings.
-
#numeric_ordering=(numeric_ordering : Bool?)
Flag that determines whether to compare numeric strings as numbers or as strings.
-
#strength : Int32?
The level of comparison to perform.
-
#strength=(strength : Int32?)
The level of comparison to perform.
-
#to_bson(bson = BSON.new)
Converts to a BSON representation.
Constructor Detail
Allocate an instance and copies data from a BSON struct.
class User
include BSON::Serializable
property name : String
end
data = BSON.new
data["name"] = "John"
User.new(data)
Create a new Collation
instance.
collation = Mongo::Collation.new(locale: "fr")
Class Method Detail
Instance Method Detail
Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.
Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.
Flag that determines whether strings with diacritics sort from back of the string, such as with some French dictionary ordering.
Flag that determines whether strings with diacritics sort from back of the string, such as with some French dictionary ordering.
A field that determines sort order of case differences during tertiary level comparisons.
A field that determines sort order of case differences during tertiary level comparisons.
Flag that determines whether to include case comparison at strength level 1 or 2.
Flag that determines whether to include case comparison at strength level 1 or 2.
Field that determines up to which characters are considered ignorable when alternate: "shifted"
. Has no effect if alternate: "non-ignorable"
Field that determines up to which characters are considered ignorable when alternate: "shifted"
. Has no effect if alternate: "non-ignorable"
Flag that determines whether to check if text require normalization and to perform normalization. Generally, majority of text does not require this normalization processing.
Flag that determines whether to check if text require normalization and to perform normalization. Generally, majority of text does not require this normalization processing.
Flag that determines whether to compare numeric strings as numbers or as strings.
Flag that determines whether to compare numeric strings as numbers or as strings.
Converts to a BSON representation.
user = User.new name: "John"
bson = user.to_bson