the group aggregate field name 'org_data.center' cannot be used because $group's field names cannot contain '.'


           $following_pipe[] =  [
               '$group' => ['_id' => '$' . $groupBy,
               'org_data.center' => [

                   ['$first' => '$org_data.center.longitude'],
                   ['$first' => '$org_data.center.latitude'],

                   ],
                'org_data._id' => [
                    ['$first' => '$_id'],
                ]
                   
                ]
            ];

the group aggregate field 'center' must be defined as an expression inside an object