I am new to Mongodb trying to count the number of Delta values in DELTA_GROUP. In this example there are three "Delta" values under "DELTA_GROUP". In this case, the count value is 3 for this object. I need to satisfy two conditions here though.
First of all, I need to only count data collected within the specific time range I set (ex. between start point and end point using ISODate(gte,lte, etc)).
The Second, in the data with the specific time range, I want to count the number of delta values for every object and of course, there are a handful of objects within the specified time range. Thus, if I assume that there are only three delta values for each object (from example), and 10 objects total, the count result should be 30. How can I create a query for it with conditions above?
{
    "_id" : ObjectId("5f68a088135c701658c24d62"),
    "DELTA_GROUP" : [ 
        {
            "Delta" : 105,
        }, 
        {
            "Delta" : 108,
        }, 
        {
            "Delta" : 103,
        }
],
    "YEAR" : 2020,
    "MONTH" : 9,
    "DAY" : 21,
    "RECEIVE_TIME" : ISODate("2020-09-21T21:46:00.323Z")
}
What I have tried so far is shown below. In this way, I was able to list out counted value for each object, but still need to work to get totalized counted value for specified range of dates.
db.DELTA_DATA.aggregate([
{$match: 
    {'RECEIVE_TIME': 
        {
            $gte:ISODate("2020-09-10T00:00:00"),
            $lte:ISODate("2020-10-15T23:59:59")
        }
    }},
{$project: {"total": {count : {"$size":"$DELTA_GROUP"}}}}])
