I have a mongoDB collection looks like this:
{u'_id': ObjectId('5b243611dba907285af051ee'),
u'cms_prescription_counts': {u'ABILIFY': 11,
u'ALLOPURINOL': 86,
u'ALPRAZOLAM': 45,
u'AMLODIPINE BESYLATE': 175,
u'AMLODIPINE BESYLATE-BENAZEPRIL': 12,
u'ATENOLOL': 62,
u'ATENOLOL-CHLORTHALIDONE': 53,
u'ATORVASTATIN CALCIUM': 19,
u'AZITHROMYCIN': 18}},
{u'_id': ObjectId('5b243611dba90728sad51ee'),
u'cms_prescription_counts': {u'ABILIFY': 11,
u'ALLOPURINOL': 70,
u'ALPRAZOLAM': 20,
u'AMLODIPINE BESYLATE': 15,
u'AMLODIPINE BESYLATE-BENAZEPRIL': 24,
u'ATENOLOL': 62,
u'ATENOLOL-CHLORTHALIDONE': 53,
u'ATORVASTATIN CALCIUM': 19,
u'AZITHROMYCIN': 18}
...
...
So I want to get the total amount of 'ALPRAZOLAM' across the collection. I tried $group as follow:
{"$group": {
"_id": "cms_prescription_counts",
"total": {"$sum": "I don't know what to enter here" }
}}
Anyone can help me? Thanks!!!