driver-legacy/src/main/com/mongodb/DBCollection.java
@Deprecated
    public DBObject group(final GroupCommand cmd, final ReadPreference readPreference) {
        return toDBList(executor.execute(cmd.toOperation(getNamespace(), getDefaultDBObjectCodec(), retryReads), readPreference,
                getReadConcern()));
    }
@Deprecated
    public DBObject group(final GroupCommand cmd, final ReadPreference readPreference) {
        return toDBList(executor.execute(cmd.toOperation(getNamespace(), getDefaultDBObjectCodec(), retryReads), readPreference,
                getReadConcern()));
    }
Group documents in a collection by the specified key and performs simple aggregation functions such as computing counts and sums.
This is analogous to a {@code SELECT ... GROUP BY} statement in SQL.

@param cmd            the group command
@param readPreference {@link ReadPreference} to be used for this operation
@return a document with the grouped records as well as the command meta-data
@mongodb.driver.manual reference/command/group/ Group Command
@deprecated The group command was deprecated in MongoDB 3.4