here is my collection records
[
    {
        "username" : "av4617",
        "subscriptions" : [ 
            {
                "sub_id" : "5a56fd399dd78e33948c9b8e",
                "activation_date" : ISODate("2018-01-01T00:00:00.000Z")
            }, 
            {
                "sub_id" : "5a56fd399dd78e33948c9b8e",
                "activation_date" : ISODate("2018-02-01T00:00:00.000Z")
            }, 
            {
                "sub_id" : "5a56fd399dd78e33948c9b8e",
                "activation_date" : ISODate("2018-01-01T00:00:00.000Z")
            }
        ]
    },
    {
        "username" : "av4611",
        "subscriptions" : [ 
            {
                "sub_id" : "5a56fd399dd78e33948c9b8e",
                "activation_date" : ISODate("2018-01-01T00:00:00.000Z")
            }
        ]
    }
]
what i want is records having user's subscription details within range of two dates..i have tried
db.gyms.aggregate([
 {'$unwind': '$subscriptions'},   
   { "$match": { "subscriptions.activation_date": { "$exists": true } } },    
    {        
     "$redact": {      
        "$cond": [           
             { "$eq": [{ "$month": "$subscriptions.activation_date" }, 1] }, "$$KEEP","$$PRUNE"           
                 ]} } 
        ]).pretty()
But it returns
{
        "username" : "av4617",
        "subscriptions" : {
                "sub_id" : "5a56fd399dd78e33948c9b8e",
                "activation_date" : ISODate("2018-01-01T00:00:00Z")
        }
}
{
        "username" : "av4617",
        "subscriptions" : {
                "sub_id" : "5a56fd399dd78e33948c9b8e",
                "activation_date" : ISODate("2018-01-01T00:00:00Z")
        }
}
{
        "username" : "av4611",
        "subscriptions" : {
                "sub_id" : "5a56fd399dd78e33948c9b8e",
                "activation_date" : ISODate("2018-01-01T00:00:00Z")
        }
}
when i tried to have $$DESCEND in place of $$KEEP it works on other data types..but in above query it gives me error due to date datatype..
assert: command failed: {
        "ok" : 0,
        "errmsg" : "can't convert from BSON type missing to Date",
        "code" : 16006,
        "codeName" : "Location16006"
}
What i want is subcontinent within one doc...
[{
            "username" : "av4617",
            "subscriptions" : {
                    "sub_id" : "5a56fd399dd78e33948c9b8e",
                    "activation_date" : ISODate("2018-01-01T00:00:00Z")
            },
            {
                    "sub_id" : "5a56fd399dd78e33948c9b8e",
                    "activation_date" : ISODate("2018-01-01T00:00:00Z")
            }
},
{
        "username" : "av4611",
        "subscriptions" : {
                "sub_id" : "5a56fd399dd78e33948c9b8e",
                "activation_date" : ISODate("2018-01-01T00:00:00Z")
        }
}]
 
    