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

$encStrNormalizedEq (encrypted aggregation operator)

New in version 8.2.

Note

The $encStrNormalizedEq aggregation operator is only for encrypted fields in collections with Queryable Encryption enabled. For unencrypted fields, use Text Search operators to match substrings.

$encStrNormalizedEq

Returns true if a normalized string value matches the normalized string version of the specified string. The queried field must have substring queries enabled, and the length of the query string must be between the configured minimum and maximum number of characters, inclusive.

Note

This operator must operate on a text search index.

The $encStrNormalizedEq expression has the following operator expression syntax:

{ $encStrNormalizedEq: <string> }
  • Case sensitivity and diacritical mark sensitivity are determined by the configuration of the associated text search index.

  • Searches match whitespace characters.

  • Line breaks aren't considered when matching.

  • Tokenization delimiters aren't supported.

Consider the character é, which can be represented two ways:

  • One code point, U+00E9 (Latin small letter E with acute)

  • Two code points, U+0065 (Latin small letter E) followed by U+0301 (combining acute accent)

When comparing these two different representations of the name Béatrice:

  • Using $eq evaluates to false, because the binary representations are different.

  • Using $encStrNormalizedEq evaluates to true, regardless of the diacriticSensitive setting, because the operator normalizes both strings prior to comparing them.

In mongosh:

db.collection('MyCollection', function (err, collection) {
collection.aggregate([
$match: {
'employeeLastName': { $encStrNormalizedEq: 'Béatrice' }
}])

Back

$encStrEndsWith

On this page