0
我試圖計算每月的平均航班,我收到了一條錯誤在流水線階段MongoDB的錯誤對象
「流水線級規範對象必須只包含一個領域。」,
db.Flights.aggregate([
{$unwind: "$flights"},
{$project:
{_id: 0,
status: 1,
flights: 1
},
$match: {"status": "active"},
$group: {_id: {"flights" : "$flights.flight_id", "Month": "$depart_info.month_name_long"},
avg_flights: {$avg: "$flights.count"}}}
])