izzum\statemachine\persistence\MongoDB::createIndexes PHP Метод

createIndexes() защищенный Метод

create indexes in the background for the collections used. this will only be done by mongo if they do not exist already.
protected createIndexes ( )
    protected function createIndexes()
    {
        //http://docs.mongodb.org/manual/tutorial/create-a-compound-index/
        //querying the history could use different indexes, depending on what you want to know
        //db.history.createIndex({entity_id: 1, machine: 1}, {background: true});
        $index = array("entity_id" => 1, "machine" => 1);
        $options = array("background" => true);
        $this->getClient()->izzum->history->createIndex($index, $options);
        //getting the state for an entity_id/machine should be fast
        //db.states.createIndex({entity_id: 1, machine: 1}, {background: true});
        $index = array("entity_id" => 1, "machine" => 1);
        $options = array("background" => true);
        $this->getClient()->izzum->states->createIndex($index, $options);
        //show the existing indexes
        //db.system.indexes.find()
    }