0
我是MongoTemplate的新手。我想定義一個org.springframework.data.mongodb.core.query.Query和org.springframework.data.mongodb.core.query.Criteria從具有複雜文檔結構的集合中獲取數據。 這是文件如何爲複雜文檔結構編寫MongoTemplate查詢和標準?
{
"_id" : {
"SId" : "ANBS",
"AssetId" : "ANBS_BS21",
"ST" : NumberLong(1479114000) //StartDate
},
"ET" : NumberLong(1479117599) //EndDate,
"TS" : [
NumberLong(1479114000),
NumberLong(1479114600),
NumberLong(1479115200),
NumberLong(1479115800),
NumberLong(1479116400),
NumberLong(1479117000)
],
"Tags" : {
"ActivePower" : {
"Avg" : [
16427.575,
16991.01,
16708.2016666667,
16488.335,
17230.1933333333,
15996.9783333333
]
},
"WindSpeed" : {
"Avg" : [
64.4266666666667,
60.8583333333333,
65.275,
62.8766666666667,
63.2166666666667,
63.14
]
}
}
我想獲取所有給定TIMERANGE(開始時間和結束時間),其中由assetid =文件? AND startTime> = ST AND endTime < = ET。
有人可以幫我解決這個問題嗎?我不想要mongo查詢,但我想要基於MongoTemplate的查詢和條件。提前致謝。
請添加您到目前爲止嘗試過的任何 – Veeram