For AI agents: a documentation index is available at https://www.mongodb.com/zh-cn/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
MongoDB Branding Shape
Click here >
Docs 菜单

MongoDB搜索兼容性和限制

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

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 十亿个索引对象的单个索引的更改。这意味着您的索引仍然可查询,但可能会得到过时的结果。

如果您的集合包含 16MB 或更大的document,MongoDB Search 无法为您的document索引,从而导致您的索引变得过时,并启动完整索引重建。您必须从集合中删除违规document(s)才能成功完成索引重建。当对大型文档的更新操作导致变更流事件超过 16MB BSON 限制时,也可能会出现此问题。为避免这种情况,建议集合中的单个 document 不要超过 8 MB。请考虑以下最佳实践:

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

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

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

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

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

如果您使用的是聚集文档并将notablescan参数设立为true,则您的MongoDB搜索索引可能无法完成构建。要解决此问题,您必须将 notablescan 参数设立为 false 或检查日志以了解索引状态转换。

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

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