I have below format mongodb doc
/* 1 */
{
"_id" : "5f5b1b5d89967c6c48003346",
"UID" : "5f5b15ca89967c6c4800327d",
"_createdAt" : "2020-09-11 12:08:21",
},
/* 2 */
{
"_id" : "5f5b16f789967c6c480032d1",
"UID" : "5f5b15ca89967c6c4800327d",
"_createdAt" : "2020-09-11 11:49:35",
},
/* 3 */
{
"_id" : "5f5b16b389967c6c480032b8",
"UID" : "5f5b15ca89967c6c4800327d",
"_createdAt" : "2020-09-11 11:48:27",
},
/* 4 */
{
"_id" : "5f5b15cd89967c6c48003282",
"UID" : "5f5b15ca89967c6c4800327d",
"_createdAt" : "2020-09-11 11:44:37",
}
current time is 2020-09-11 12:10:21
I have to fetch records 10 minutes before _createdAt (current time - 10 minutes).
My expected output
/* 2 */
{
"_id" : "5f5b16f789967c6c480032d1",
"UID" : "5f5b15ca89967c6c4800327d",
"_createdAt" : "2020-09-11 11:49:35",
},
/* 3 */
{
"_id" : "5f5b16b389967c6c480032b8",
"UID" : "5f5b15ca89967c6c4800327d",
"_createdAt" : "2020-09-11 11:48:27",
},
/* 4 */
{
"_id" : "5f5b15cd89967c6c48003282",
"UID" : "5f5b15ca89967c6c4800327d",
"_createdAt" : "2020-09-11 11:44:37",
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…