我在mongo数据库中具有以下结构,(不同的时间来自数据库),
{
{
_id:ObjectId(5e64be116c0a0b7d40e9387a),
"macid":"40:A3:6B:70:01:FE"
"readings":{
"timestamp":1521438794
"log":"last log with time"
}
},
{
_id:ObjectId(5e64be116c0a0b7d40e9387a),
"macid":"40:A3:6B:70:01:FE"
"readings":{
"timestamp":1584597196
"log":"last log with time"
}
},
{
_id:ObjectId(5e64be116c0a0b7d40e9387a),
"macid":"40:A3:6B:70:01:FE"
"readings":{
"timestamp":1584597607
"log":"last log with time"
}
}
}
文档中存在不同的纪元时间。 我想以本地时区以以下格式获取数据。
{
"19 March 2020 ":[
{
"log":"last log with time",
"timestamp" :"11:23:16"},
{
"log":"last log with time",
"timestamp" :"11:30:07"},
],
"9 March 2018":[{
"log":"last log with time",
"timestamp" :"11:23:14"}
]
}
是否可以通过mongo查询?。我尝试过,但无法正常工作,查询很大,要粘贴到这里。