对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

MongoDB搜索兼容性和限制

This page describes the compatibility and limitations of MongoDB Search features on Atlas. For details on MongoDB Search compatibility with self-managed deployments, see Compatibility and Requirements for mongot.

对于某些功能, MongoDB Search 可能需要特定版本的MongoDB。下表列出了需要特定MongoDB版本的MongoDB搜索功能。

MongoDB搜索功能
适合该功能的 MongoDB 版本

8.0 +

使用 $search$searchMeta 直接查询视图

8.1 +

分片视图上的$search$searchMeta

8.2 +

$rankFusion 在视图上

8.2 +

7.0 +、 8.0 +

7.0 +、 8.0 +

7.0 +、 8.0 +

7.0 +、 8.0 +

7.0 +、 8.0 +

7.0 +、 8.0 +

7.0 +、 8.0 +

7.0 +、 8.0 +

7.0 +、 8.0 +

7.0 +、 8.0 +

$search searchAftersearchBefore 选项

6.0.13+, 7.0.5+, 8.0+

MongoDB Search is not supported for time series collections. Starting in MongoDB 8.3, the $search, $searchMeta, and $vectorSearch stages fail with an error message when run on timeseries collections. Previously, these stages returned empty results.

以下限制仅应用于免费集群和 Flex 集群上的MongoDB Search:

  • 您创建的内容不能超过:

    • 免费集群上的 3 索引(无论是 search 还是 vector 类型)。

    • 针对 Flex 集群的 10 个索引。

  • 当达到集群层允许的最大索引数时,您可以扩展集群层以创建更多索引。如果扩展集群层,则会在新的集群层上重建索引,从而触发初始同步。

  • 索引定义 JSON 对象的大小不能超过 3KB。

  • 一个索引定义只能具有一个同义词映射

  • 构建包含超过 300 个字段的索引失败。

  • Lucene 的默认子句限制 1024 适用于为搜索创建的任何 BooleanQuery

  • 同义词集合不能超过 10,000 个文档。

  • MongoDB Search doesn't support encrypting MongoDB Search indexes with encryption keys using Customer Key Management in the Atlas UI.

注意

要了解搜索游乐场的限制,请参阅搜索游乐场的限制。

要学习;了解支持的客户端,请参阅索引查询

If you create a MongoDB Search index that has or will soon have more than 2.1 billion index objects, you must use numPartitions or shard your cluster. For this limit, each top-level document or nested embeddedDocument in the indexed collection fields counts as one object

默认下, MongoDB搜索会停止复制任何给定副本集成员或分片上增长超过 2.1 十亿个索引对象的单个索引的更改。这意味着您的索引仍然可查询,但可能会得到过时的结果。

If your collection contains documents that are 16MB or larger, MongoDB Search fails to index your document, causing your index to become STALE, and initiates a full index rebuild. You must delete the offending document(s) from your collection in order for index rebuild to successfully complete. This issue can also occur when update operations on large documents cause the change stream event to exceed the 16MB BSON limit. To avoid this, we recommend that no single document in your collection exceeds 8MB. Consider the following best practices:

  • 将您的文档结构化,以减少子文档或数组的大小。

  • 避免执行更新或替换大字段、子文档或数组的操作。

To learn more, see Change Streams Production Recommendations and Reduce the Size of Large Documents.

要学习;了解有关索引限制的更多信息,请参阅:

要了解字段类型的限制,请参阅:

If you're using a clustered collection and have the notablescan parameter set to true, your MongoDB Search indexes may not finish building. To resolve this issue, you must set the notablescan parameter to false or check your log for index status transitions.

要学习查询操作符的限制,请参阅:

要了解查询选项的兼容性和限制,请参阅: