mongodb\QueryBuilder createIndexes()

createIndexes() public method

public array createIndexes ( $databaseName, $collectionName, $indexes )
$databaseName string|null

Database name.

$collectionName string

Collection name.

$indexes array[]

Indexes specification. Each specification should be an array in format: optionName => value The main options are:

  • keys: array, column names with sort order, to be indexed. This option is mandatory.
  • unique: boolean, whether to create unique index.
  • name: string, the name of the index, if not set it will be generated automatically.
  • background: boolean, whether to bind index in the background.
  • sparse: boolean, whether index should reference only documents with the specified field.

See [[https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options-for-all-index-types]] for the full list of options.

return array

Command document.

doc_Yii
2016-10-30 17:09:06
Comments
Leave a Comment

Please login to continue.