def _get_group_id_fields(self, keys, parent=''):
        date_operators = [
            '$dayOfYear',
            '$dayOfMonth',
            '$dayOfWeek',
            '$year',
            '$month',
            '$week',
            '$hour',
            '$minute',
            '$second',
            '$millisecond']

        fields = []

        if isinstance(keys, dict):
            for k, v in keys.items():
                if isinstance(v, str):
                    if k in date_operators:
                        fields.append((parent + '__' + k + '_' + v).replace('$', ''))
                    else:
                        fields.append(v.replace('$', ''))
                elif isinstance(v, dict):
                    fields.extend(self._get_group_id_fields(v, parent + '__' + k if parent else k))
        elif isinstance(keys, str):
            fields.append(keys.replace('$', ''))

        return fields
dataset/ETHPy150Open vmalloc/mongomock/mongomock/collection.py/Collection._get_group_id_fields/original