明树Git Lab

Commit dfaf3303 authored by zengfanpei's avatar zengfanpei

update

parent 1520c23b
...@@ -139,11 +139,14 @@ async function getWSChangeTrend(req, res, next) { ...@@ -139,11 +139,14 @@ async function getWSChangeTrend(req, res, next) {
{ {
$group: { $group: {
_id: { $dateToString: { format: "%Y-%m-%d", date: "$time" } }, // 将时间戳转换为日期字符串 _id: { $dateToString: { format: "%Y-%m-%d", date: "$time" } }, // 将时间戳转换为日期字符串
wsTemperature: {$round: [{ $avg: "$wsTemperature" }, 2]}, wsTemperature: { $avg: "$wsTemperature" },
wsMoisture: {$round: [{ $avg: "$wsMoisture" }, 2]}, wsMoisture: { $avg: "$wsMoisture" },
rainfall: {$round: [{ $avg: "$rainfall" }, 2]}, rainfall: { $avg: "$rainfall" },
} }
}, },
{$project: {
wsTemperature: {$round: ["$wsTemperature", 2]}
}},
{ $sort: { _id: 1 } } { $sort: { _id: 1 } }
]; ];
let ret = await DB.CollectWS.aggregate(aggr); let ret = await DB.CollectWS.aggregate(aggr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment