对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
See how MongoDB 9.0 delivers up to 2x higher throughput.
MongoDB Branding Shape
Register now >
Docs 菜单

自管理部署上的文本索引版本

注意

MongoDB提供改进的全文搜索解决方案MongoDB Search和向量搜索解决方案MongoDB Vector Search。我们建议使用MongoDB Search 索引或MongoDB Vector Search 索引,而不是文本索引。

文本索引有以下版本:

textIndexVersion
说明

版本 3

MongoDB 3.2 引入了文本索引第 3 版。 版本 3 是在 MongoDB 3.2 及更高版本中创建的文本索引的默认版本。

版本 2

MongoDB 2.6 引入了文本索引版本 2。 版本 2 是在 MongoDB 2.6 到 3.0 中创建的文本索引的默认版本。

版本 1

MongoDB 2.4 引入文本索引版本 1。 MongoDB 2.4 仅支持版本 1。

重要

尽可能始终使用默认索引版本。 仅在出于兼容性原因需要时才覆盖默认版本。

要覆盖默认版本并为文本索引指定不同版本,请在创建索引时设置textIndexVersion选项:

db.<collection>.createIndex(
{ <field>: "text" },
{ "textIndexVersion": <version> }
)

以下命令在content字段上创建版本 2 文本索引:

db.test.createIndex(
{ "content": "text" },
{ "textIndexVersion": 2 }
)
给本页内容打分

在此页面上