Using a for loop checking the curent timestamp and last timestamp different

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>

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. :cry:
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!!

@K_Gum Could you provide the sample document and the expected result?

Hello @Sudhesh_Gnanasekaran ,
the result data will be visualized using table chart.

I want to be able to define cycles by checking the time different is greater than 1s.

{ "_id": { "time_utc": "2021-09-06T08:44:35.000Z" }, "signals": { "OperMod": "Torque", "power": null } },

{ "_id": { "time_utc": "2021-09-06T08:44:36.000Z" }, "signals": { "OperMod": "Torque", "power": null } },

{ "_id": { "time_utc": "2021-09-06T08:44:37.000Z" }, "signals": { "OperMod": "Torque", "power": null } },