[英]Mongo DB / No duplicates
I have have a mongo collection that keeps state records for devices. 我有一个mongo集合,用于保存设备的状态记录。 Thus, there could be multiple records per device.
因此,每个设备可能有多个记录。 What I would like to do is create a query through the mongoTemplate that gets the latest record for each device.
我想做的是通过mongoTemplate创建一个查询,该查询获取每个设备的最新记录。
Here's the constraints: 这里是约束:
example of collection object: 收集对象的示例:
{
_id: "241324123412",
name_id: "flyingMan",
powerState:"ON",
timeStamp: ISODate('')
}
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.