src/League/Monga/Query/Aggregation.php
public function group($group)
    {
        if ($group instanceof Closure) {
            $callback = $group;
            $group = new Group();
            is_callable('Closure::bind') && $callback = $callback->bindTo($group, $group);
            $callback($group);
        }

        if ($group instanceof Group) {
            $group = $group->getGroup();
        }

        $this->pipeline[] = ['$group' => $group];

        return $this;
    }
public function group($group)
    {
        if ($group instanceof Closure) {
            $callback = $group;
            $group = new Group();
            is_callable('Closure::bind') && $callback = $callback->bindTo($group, $group);
            $callback($group);
        }

        if ($group instanceof Group) {
            $group = $group->getGroup();
        }

        $this->pipeline[] = ['$group' => $group];

        return $this;
    }
public function group ( $ group ) { if ( $ group instanceof Closure ) { $ callback = $ group ; $ group = new Group ( ) ; is_callable ( 'Closure::bind' ) && $ callback = $ callback -> bindTo ( $ group , $ group ) ; $ callback ( $ group ) ; } if ( $ group instanceof Group ) { $ group = $ group -> getGroup ( ) ; } $ this -> pipeline [ ] = [ '$group' => $ group ] ; return $ this ; }
Group the results.

@param mixed $projection projection array / closure / Query\Group instance

@return object $this
Group the results .