Changed opts.group to opts.groupBy