Documentation

IndexInfo
in package
implements ArrayAccess, Stringable

Index information model class.

This class models the index information returned by the listIndexes command or, for legacy servers, queries on the "system.indexes" collection. It provides methods to access common index options, and allows access to other options through the ArrayAccess interface (write methods are not supported). For information on keys and index options, see the referenced db.collection.createIndex() documentation.

Tags
see
Collection::listIndexes()
see
https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.md
see
https://mongodb.com/docs/manual/reference/method/db.collection.createIndex/
template-implements

Table of Contents

Interfaces

ArrayAccess
Stringable

Properties

$info  : array<string|int, mixed>

Methods

__construct()  : mixed
__debugInfo()  : array<string|int, mixed>
Return the collection info as an array.
__toString()  : string
Return the index name to allow casting IndexInfo to string.
getKey()  : array<string|int, mixed>
Return the index key.
getName()  : string
Return the index name.
getVersion()  : int
Return the index version.
is2dSphere()  : bool
Return whether or not this index is of type 2dsphere.
isSparse()  : bool
Return whether this is a sparse index.
isText()  : bool
Return whether or not this index is of type text.
isTtl()  : bool
Return whether this is a TTL index.
isUnique()  : bool
Return whether this is a unique index.
offsetExists()  : bool
Check whether a field exists in the index information.
offsetGet()  : mixed
Return the field's value from the index information.
offsetSet()  : void
Not supported.
offsetUnset()  : void
Not supported.

Properties

$info

private array<string|int, mixed> $info

Methods

__construct()

public __construct(array<string|int, mixed> $info) : mixed
Parameters
$info : array<string|int, mixed>

Index info

__toString()

Return the index name to allow casting IndexInfo to string.

public __toString() : string
Return values
string

getKey()

Return the index key.

public getKey() : array<string|int, mixed>
Return values
array<string|int, mixed>

getName()

Return the index name.

public getName() : string
Return values
string

getVersion()

Return the index version.

public getVersion() : int
Return values
int

is2dSphere()

Return whether or not this index is of type 2dsphere.

public is2dSphere() : bool
Return values
bool

isText()

Return whether or not this index is of type text.

public isText() : bool
Return values
bool

offsetGet()

Return the field's value from the index information.

public offsetGet(mixed $offset) : mixed

This method satisfies the Enumerating Indexes specification's requirement that index fields be made accessible under their original names. It may also be used to access fields that do not have a helper method.

Parameters
$offset : mixed
Tags
see
https://php.net/arrayaccess.offsetget
see
https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.md#getting-full-index-information
psalm-param

array-key $offset


        
On this page

Search results