Doctrine\MongoDB\Query\Builder::exclude PHP Method

exclude() public method

If fields have been selected for inclusion, only the "_id" field may be excluded.
public exclude ( $fieldName = null )
    public function exclude($fieldName = null)
    {
        if (!isset($this->query['select'])) {
            $this->query['select'] = [];
        }
        $fieldNames = is_array($fieldName) ? $fieldName : func_get_args();
        foreach ($fieldNames as $fieldName) {
            $this->query['select'][$fieldName] = 0;
        }
        return $this;
    }