我正在尝试这个聚合我得到了确切的输出但没有得到所有字段请解决我的问题如何获得以下查询中的所有字段
db.lights.aggregate({ $match: { CREATE_DATE: { $gte: ISODate("2018-01-24T20:05:30.000Z"), $lt: ISODate("2018-02-24T20:05:30.000Z") } } }, { $addFields: { offduration: { $divide: [{ $subtract: ["$RECEIVEDDATE", "$CREATE_DATE"] }, 3600000] } } }, { "$group": { _id: { SWITCHID: "$SWITCHID", STATUS: "$STATUS" }, avgduration: { $avg: "$offduration" }, SWITCHID: { $first: "$SWITCHID" }, CREATE_DATE: { $first: "$CREATE_DATE" }, RECEIVEDDATE: { $first: "$RECEIVEDDATE" }, STATUS: { $first: "$STATUS" }, offduration: { $first: "$offduration" }, } }, { $project: { _id: 0, SWI`TCHID: 1, CREATE_DATE: 1, RECEIVEDDATE: 1, STATUS: 1, avgduration: '$avgduration', offduration: '$offduration' } },{"$group" : { _id: { SWITCHID: "$SWITCHID" }, on_minus_off: { $sum:{ "$cond": [ { "$eq": ["$STATUS", "LIGHTS OFF"] }, "$avgduration", { $subtract: [ 0, "$avgduration" ] } ]}} }})