La notación posicional en la agregación parece no ser compatible todavía, ver este ticket .
Como dice @Sammaye, primero debe desenrollar la matriz o reemplazar su matriz de coordenadas con un lng
incrustado /lat
documento incrustado, lo que haría que esto fuera trivial.
Dada la estructura de la matriz, puede relajarse y proyectar la latitud/longitud así:
myColl.aggregate([
// unwind the coordinates into separate docs
{$unwind: "$myCoordinates"},
// group back into single docs, projecting the first and last
// coordinates as lng and lat, respectively
{$group: {
_id: "$_id",
lng: {$first: "$myCoordinates"},
lat: {$last: "$myCoordinates"}
}},
// then group as normal for the averaging
{$group: {
_id: 0,
lngAvg: {$avg: "$lng"},
latAvg: {$avg: "$lat"}
}}
]);