MongoDb query to calculate time between alternating on off switch
{ metadata:{ eventcode:100 } power:on // this can be either on or off time:1667984669//unix timestamp } My document looks something like this the power can be on or it can be off, given to and from time I have to…