PHP Class Webiny\Component\Mongo\Index\AbstractIndex

Inheritance: implements Webiny\Component\Mongo\Index\IndexInterface, use trait Webiny\Component\StdLib\StdLibTrait
Show file Open project: Webiny/Framework Class Usage Examples

Protected Properties

Property Type Description
$dropDuplicates
$fields
$name
$sparse
$unique

Public Methods

Method Description
__construct ( string $name, array $fields, boolean $sparse = false, boolean $unique = false, boolean $dropDuplicates = false )
getDropDuplicates ( ) : boolean
getFields ( ) : array
getName ( ) : string
getOptions ( ) : array Get mongo index options
getSparse ( )
getUnique ( ) : boolean

Protected Methods

Method Description
normalizeFields ( ) : void If fields are in '+/-' syntax, convert them to associative array suitable for Mongo

Method Details

__construct() public method

public __construct ( string $name, array $fields, boolean $sparse = false, boolean $unique = false, boolean $dropDuplicates = false )
$name string Index name
$fields array Index fields, ex: title (ascending), -title (descending)
$sparse boolean Is index sparse?
$unique boolean Is index unique?
$dropDuplicates boolean Drop duplicate documents (only if $unique is used)

getDropDuplicates() public method

public getDropDuplicates ( ) : boolean
return boolean

getFields() public method

public getFields ( ) : array
return array

getName() public method

public getName ( ) : string
return string

getOptions() public method

Get mongo index options
public getOptions ( ) : array
return array

getSparse() public method

public getSparse ( )

getUnique() public method

public getUnique ( ) : boolean
return boolean

normalizeFields() protected method

If fields are in '+/-' syntax, convert them to associative array suitable for Mongo
protected normalizeFields ( ) : void
return void

Property Details

$dropDuplicates protected property

protected $dropDuplicates

$fields protected property

protected $fields

$name protected property

protected $name

$sparse protected property

protected $sparse

$unique protected property

protected $unique