Mongo Playground

Configuration

[{"_id":ObjectId("5a934e000102030405000000"),"title":"Sensor 1","totals":[{"count":1,"timestamp":ISODate("2022-09-12T06:00:00Z")},{"count":2,"timestamp":ISODate("2022-09-12T07:00:00Z")},{"count":3,"timestamp":ISODate("2022-09-12T08:00:00Z")},{"count":4,"timestamp":ISODate("2022-09-12T09:00:00Z")},{"count":128,"timestamp":ISODate("2022-09-12T10:00:00Z")}]},{"_id":ObjectId("5a934e000102030405000001"),"title":"Sensor 2","totals":[{"count":123,"timestamp":ISODate("2022-09-12T10:00:00Z")}]}]

Query

db.collection.aggregate([{"$set":{"totals":{"$ifNull":["$totals",[]]}}},{"$set":{"totals":{"$filter":{"input":"$totals","cond":{"$gte":["$$this.timestamp",ISODate("2022-09-11T14:00:00Z")]}}}}},{"$set":{"count":{"$sum":"$totals.count"}}},{"$unset":"totals"}])

Result