Mongodb $subtract document value from the next one
问题 I have a collection of documents as below. Example of my collection documents { "_id" : 1, "_DeviceName" : "Main Panel", "_Timestamp" : ISODate("2017-08-04T23:15:00.000+03:00"), "_LocationID" : ObjectId("598459e86b41c036f051217c"), "Meters" : { "gasmeter" : 1000.0, }}, { "_id" : 2, "_DeviceName" : "Main Panel", "_Timestamp" : ISODate("2017-08-04T23:15:00.000+03:00"), "_LocationID" : ObjectId("598459e86b41c036f051217c"), "Meters" : { "gasmeter" : 1007.0, }}, { "_id" : 3, "_DeviceName" : "Main