Docs Menu
Docs Home
/ / /
PHP Library Manual
/ /

MongoDB\Collection::listSearchIndexes()

On this page

  • Definition
  • Parameters
  • Return Values
  • Errors/Exceptions
  • See Also

New in version 1.17.

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.

$options : array

An array specifying the desired options.

Name
Type
Description

batchSize

integer

Specifies the batch size for the cursor, which will apply to both the initial aggregate command and any subsequent getMore 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 initial aggregate command; subsequent getMore commands will use the server's default batch size. This may be useful for quickly returning a cursor or failure from aggregate without doing significant server-side work.

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 the typeMap 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.

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.

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).

Back

listIndexes()