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.
NameTypeDescriptionbatchSizeintegerSpecifies the batch size for the cursor, which will apply to both the initial
aggregate
command and any subsequentgetMore
commands. This determines the maximum number of documents to return in each response from the server.A batchSize of
0
is special in that and will only apply to the initialaggregate
command; subsequentgetMore
commands will use the server's default batch size. This may be useful for quickly returning a cursor or failure fromaggregate
without doing significant server-side work.codecMongoDB\Codec\DocumentCodecThe 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.
collationarray|objectCollation 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.commentmixedEnables users to specify an arbitrary comment to help trace the operation through the database profiler, currentOp output, and logs.
maxTimeMSintegerThe cumulative time limit in milliseconds for processing operations on the cursor. MongoDB aborts the operation at the earliest following interrupt point.
namestringName of the index to return information about.
If name is not specified, information for all indexes on the collection will be returned.
readConcernRead 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.readPreferenceRead preference to use for the operation. Defaults to the collection's read preference.
sessionClient session to associate with the operation.
typeMaparrayThe 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