private function checkIndexIsEligible()
    {
        $index = $this->getIndex();

        if ($index->isSecondaryGlobal() && !$index->hasAttributes($this->expr->getAttributes())) {
            throw ODMException::queryIndexProjectionIncompatible();
        }

        return (bool)$this->getKeyCondition();
    }