Hello,
I am learning MongoDB now.
I want to check the current timestamp and last timestamp is greater than 1 second.
if yes, then cycle count as 1.
In this case, for loop would be applied.
What is the best way to implement?
is it possible to use list
for checking the timestamp?
{
"$project": {
<#list cycles as cycle>
"${time}": "${1}" <#timeStart>,</#timeEnd>
</#list>
}
}
for other programming language:
for (i=1;i<=50; i++) {
TimeDiff = time(i) - time(i-1)
if (TimeDiff >1)
j=1, j++
I am so lost in searching the method of the for loop in MongoDB.
Maybe if anyone could give me a bit direction how to think the implementation. Any help would be appreciated.
thank you so much for reading!!