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"}}}
])