Definition定义
New in version 8.2.在版本8.2中新增。
Note
The $encStrEndsWith aggregation operator is only for encrypted fields in collections with Queryable Encryption enabled. For unencrypted fields, use Text Search operators to match substrings.$encStrEndsWith聚合运算符仅适用于启用了可查询加密的集合中的加密字段。对于未加密的字段,使用文本搜索运算符匹配子字符串。
$encStrEndsWithReturns如果字符串值的最后一个字符与指定字符串中的字符匹配,则返回trueif the last characters of a string value match the characters in the specified string. The queried field must have suffix queries enabled, and the length of the query string must be between the configured minimum and maximum number of characters, inclusive.true。查询字段必须启用后缀查询,查询字符串的长度必须介于配置的最小和最大字符数之间(包括最小和最大值)。By default, strings must match case and diacritical marks.默认情况下,字符串必须匹配大小写和变音符号。Set在加密架构中将caseSensitivetofalsein the encryption schema for case-insensitive matching.caseSensitive设置为false,以进行不区分大小写的匹配。Set在加密架构中将diacriticSensitivetofalsein the encryption schema to disregard diacritic variations when matching.diacriticSensitive设置为false,以便在匹配时忽略变音符号变化。
The$encStrEndsWithexpression has the following operator expression syntax:$encStrEndsWith表达式具有以下运算符表达式语法:{ $encStrEndsWith: { input: ’$fieldname’, suffix: <target search key> } }
Behavior行为
Searches match whitespace characters.搜索匹配空白字符。Line breaks aren't considered when matching.匹配时不考虑换行。Tokenization delimiters aren't supported.不支持标记化分隔符。
Example示例
In 在mongosh:mongosh中:
db.collection('MyCollection').aggregate([
{
$match: {
$expr: {
$encStrEndsWith: {
input: '$employeeFirstName',
suffix: 'son'
}
}
}
}
])