Suppose my 2 documents are like this in mongodb. How do I find date difference between the fields "eventCreatedAt". I am using loopback 3 remote method implementation for this.
[
{
"eventType": "offer",
"currentPrice": 3,
"seller": "Medicalstudent",
"buyer": "musiciann",
"eventCreatedAt": "2022-03-09T10:25:20.308Z",
"isExistingOffer": true,
"timeDiffOfPreTran": 1,
"id": "6228853556f56afb3d995d50",
"nftId": "622880fc56f56afb3d995d4f"
},
{
"eventType": "offer",
"currentPrice": 5,
"seller": "Medicalstudentss",
"buyer": "music",
"eventCreatedAt": "2022-03-09T10:25:20.308Z",
"isExistingOffer": false,
"timeDiffOfPreTran": 4,
"id": "622f2d8e550a568093b54c93",
"nftId": "622880fc56f56afb3d995d4f"
}
]
mongoplayground
mongoplayground