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

MongoDB\Collection::listSearchIndexes()

1.17版本新增。

MongoDB\Collection::listSearchIndexes()

获取collection中一个或多个搜索索引的索引信息。

function listSearchIndexes(array $options = []): Countable&Iterator

This command can only be run on a deployment hosted on MongoDB Atlas and requires an Atlas cluster tier of at least M10. A Local Atlas Deployment can also be used for development.

$options : array

指定所需选项的数组。

名称
类型
说明

batchSize

整型

索引列表中返回的每个批处理中的最大文档数,适用于 aggregate 命令。默认下,aggregate 命令的初始批处理大小为 101 个文档,后续每个批处理的最大大小为 16 兆字节 (MiB)。此选项可以实施小于 16 MiB 的限制,但不能强制执行大于 MiB 的限制。如果将 batchSize设立为导致批量大于 16 MiB 的限制,则此选项无效。

编解码器

MongoDB\Codec\DocumentCodec

使用类型编解码器对数据进行编码,用于对文档进行编码或解码。此选项与 typeMap 选项互斥。

默认为集合的编解码器。默认 codec 选项的继承优先于 typeMap 选项的继承。

1.17版本新增。

排序规则

数组|对象

Collation allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks. When specifying collation, the locale field is mandatory; all other collation fields are optional. For descriptions of the fields, see Collation Document.

comment

混合

使用户可以指定任意注释来帮助通过数据库分析器、currentOp 输出和日志来跟踪操作。

maxTimeMS

整型

The cumulative time limit in milliseconds for processing operations on the cursor. MongoDB aborts the operation at the earliest following interrupt point.

名称

字符串

要返回信息的索引名称。

如果未指定名称,则返回collection上所有索引的信息。

事务外的

Read concern to use for the operation. Defaults to the collection's read concern.

无法将单个操作的读关注(read concern)指定为ACID 事务的一部分。相反,请在启动ACID 事务时设立readConcern 选项。

readPreference

Read preference to use for the operation. Defaults to the collection's read preference.

会话

与操作相关联的客户端会话。

typeMap

阵列

应用游标的类型映射,决定如何将BSON文档转换为PHP值。默认为集合的类型映射。

文档列表,每个文档都描述了集合上的一个Atlas Search索引。 有关输出字段的详细信息,请参阅 MongoDB 手册中的$listSearchIndexes: Output 。

MongoDB\Exception\UnsupportedException,如果所选服务器使用了选项但不支持选项(例如collation、readConcern、writeConcern)。

MongoDB\Exception\InvalidArgumentException 用于与参数或选项解析相关的错误。

MongoDB\ 驱动程序\Exception\RuntimeException 用于扩展级别的其他错误(例如连接错误)。