MongoDB\Collection::listSearchIndexes()
New in version 1.17.
Definition
MongoDB\Collection::listSearchIndexes()
Gets index information for one or more search indexes in the 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.
Parameters
$options
: arrayAn array specifying the desired options.
NameTypeDescriptionbatchSize
integer
The maximum number of documents within each batch returned in the indexes list, which applies to the
aggregate
command. By default, theaggregate
command has an initial batch size of101
documents and a maximum size of 16 mebibytes (MiB) for each subsequent batch. This option can enforce a smaller limit than 16 MiB, but not a larger one. If you setbatchSize
to a limit that results in batches larger than 16 MiB, this option has no effect.codec
MongoDB\Codec\DocumentCodec
The codec to use for encoding or decoding documents. This option is mutually exclusive with the
typeMap
option.Defaults to the collection's codec. Inheritance for a default
codec
option takes precedence over that of thetypeMap
option.New in version 1.17.
collation
array|object
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
mixed
Enables users to specify an arbitrary comment to help trace the operation through the database profiler, currentOp output, and logs.
maxTimeMS
integer
The cumulative time limit in milliseconds for processing operations on the cursor. MongoDB aborts the operation at the earliest following interrupt point.
name
string
Name of the index to return information about.
If name is not specified, information for all indexes on the collection will be returned.
readConcern
Read concern to use for the operation. Defaults to the collection's read concern.
It is not possible to specify a read concern for individual operations as part of a transaction. Instead, set the
readConcern
option when starting the transaction.readPreference
Read preference to use for the operation. Defaults to the collection's read preference.
session
Client session to associate with the operation.
typeMap
array
The type map to apply to cursors, which determines how BSON documents are converted to PHP values. Defaults to the collection's type map.
Return Values
A list of documents, each of which describes a search index on the collection. For details on the output fields, see $listSearchIndexes: Output in the MongoDB manual.
Errors/Exceptions
MongoDB\Exception\UnsupportedException
if options are used and
not supported by the selected server (e.g. collation
, readConcern
,
writeConcern
).
MongoDB\Exception\InvalidArgumentException
for errors related to
the parsing of parameters or options.
MongoDB\Driver\Exception\RuntimeException for other errors at the extension level (e.g. connection errors).
See Also
$listSearchIndexes aggregation pipeline stage reference in the MongoDB manual
Atlas Search documentation in the MongoDB Manual