mongo 到 linq 数据透视/反透视数据
我有一个如下所示的mongo集合:
日期:“2022-03-09”
dryMinTemp:“12.14”
dryMaxTemp:“14.06”
wetMinTemp:“28.08”
wetMaxTemp:“12.14”
dryHour:“02”
wetHour:“14”
1.I需要使用 C# Linq 按以下形式表示数据
:最小 |最大|小时
干燥| 12.14| 14.06| 02
湿 | 28.08| 12.14| 14
我对 mongo 和 c# 都很陌生,
- 有时我们有一个日期有 2 个文档,在这种情况下,需要为相同的类型、日期和时间组合添加最大值和最小值。
I have a mongo collection like below:
date: "2022-03-09"
dryMinTemp: "12.14"
dryMaxTemp: "14.06"
wetMinTemp: "28.08"
wetMaxTemp: "12.14"
dryHour: "02"
wetHour: "14"
1.I need to represent data using c# Linq in below form:
Type | Min | Max| Hour
Dry | 12.14| 14.06| 02
Wet | 28.08| 12.14| 14
I am new to both mongo and c#
- there can be cases when we have 2 documents for one date, in that case max and min need to be added for same type, date and hour combination.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以通过使用 group by 制作单独的列表,然后在显示输出之前将它们合并在一起来解决此问题。
I was able to fix this by making separate lists using group by and then merging them together before showing the output.