且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Mongodb 匹配重音字符作为底层字符

更新时间:2023-02-20 21:52:28

从 Mongo 3.2 开始,您可以使用 $text 并将 $diacriticSensitive 设置为 false:>

As of Mongo 3.2, you can use $text and set $diacriticSensitive to false:

{
  $text:
    {
      $search: <string>,
      $language: <string>,
      $caseSensitive: <boolean>,
      $diacriticSensitive: <boolean>
    }
}

在 Mongo 文档中查看更多信息:https://docs.mongodb.com/manual/reference/operator/query/text/

See more in the Mongo docs: https://docs.mongodb.com/manual/reference/operator/query/text/