public function explain($collectionName, $query)
    {
        $query = array_merge(
            ['find' => $collectionName],
            $query
        );

        if (isset($query['filter'])) {
            $query['filter'] = (object) $this->buildCondition($query['filter']);
        }
        if (isset($query['projection'])) {
            $query['projection'] = $this->buildSelectFields($query['projection']);
        }
        if (isset($query['sort'])) {
            $query['sort'] = $this->buildSortFields($query['sort']);
        }

        return [
            'explain' => $query,
        ];
    }
public function explain($collectionName, $query)
    {
        $query = array_merge(
            ['find' => $collectionName],
            $query
        );

        if (isset($query['filter'])) {
            $query['filter'] = (object) $this->buildCondition($query['filter']);
        }
        if (isset($query['projection'])) {
            $query['projection'] = $this->buildSelectFields($query['projection']);
        }
        if (isset($query['sort'])) {
            $query['sort'] = $this->buildSortFields($query['sort']);
        }

        return [
            'explain' => $query,
        ];
    }
public function explain ( $ collectionName , $ query ) { $ query = array_merge ( [ 'find' => $ collectionName ] , $ query ) ; if ( isset ( $ query [ 'filter' ] ) ) { $ query [ 'filter' ] = ( object ) $ this -> buildCondition ( $ query [ 'filter' ] ) ; } if ( isset ( $ query [ 'projection' ] ) ) { $ query [ 'projection' ] = $ this -> buildSelectFields ( $ query [ 'projection' ] ) ; } if ( isset ( $ query [ 'sort' ] ) ) { $ query [ 'sort' ] = $ this -> buildSortFields ( $ query [ 'sort' ] ) ; } return [ 'explain' => $ query , ] ; }
Generates 'explain' command.
@param string $collectionName collection name.
@param array $query query options.
@return array command document.
Generates explain command .