Get overall count

Hey there,

I want to get the overall count, so suppose I have the following documents

{ 
    "_id" : "no-segment_2019:12", 
    "d" : {
        "10" : {
            "12" : {
                "c" : NumberInt(3)
            }, 
            "c" : NumberInt(3)
        }
    }, 
    "m" : "2019:12", 
    "s" : "no-segment"
},
{ 
    "_id" : "no-segment_2019:12", 
    "d" : {
        "28" : {
            "11" : {
                "c" : NumberInt(2)
            }, 
            "c" : NumberInt(2)
        }
    }, 
    "m" : "2019:11", 
    "s" : "no-segment"
}

How do I get the 5 (starting with common.db.collection()). I searched for "flattening the query" and found this, but it requires fields to have same names (which is not given due being dependent on the date).

Thanks in advance!

0

Comments

1 comment

Please sign in to leave a comment.