public function group($keys, $initial, $reduce, $options = [])
    {
        return $this->database->createCommand()->group($this->name, $keys, $initial, $reduce, $options);
    }
public function group($keys, $initial, $reduce, $options = [])
    {
        return $this->database->createCommand()->group($this->name, $keys, $initial, $reduce, $options);
    }
public function group ( $ keys , $ initial , $ reduce , $ options = [ ] ) { return $ this -> database -> createCommand ( ) -> group ( $ this -> name , $ keys , $ initial , $ reduce , $ options ) ; }
Performs aggregation using Mongo "group" command.
@param mixed $keys fields to group by. If an array or non-code object is passed,
it will be the key used to group results. If instance of [[\MongoDB\BSON\Javascript]] passed,
it will be treated as a function that returns the key to group by.
@param array $initial Initial value of the aggregation counter object.
@param \MongoDB\BSON\Javascript|string $reduce function that takes two arguments (the current
document and the aggregation to this point) and does the aggregation.
Argument will be automatically cast to [[\MongoDB\BSON\Javascript]].
@param array $options optional parameters to the group command. Valid options include:
- condition - criteria for including a document in the aggregation.
- finalize - function called once per unique key that takes the final output of the reduce function.
@return array the result of the aggregation.
@throws Exception on failure.
Performs aggregation using Mongo group command .