I looked at a few answers and examples related to the above topic (including on SO), but could not find a working example for using the answers to my requirements:
I have a set of documents containing several dimensions (descriptive attributes) and metrics. I want to count the number of events (unique), a specific key value within a certain group of other keys. that is, how many players arrived from the country and speak a certain language.
Document structure:
{ "date": "2013-06-13T00:00:00.000Z" "Operating System": "Windows 7", "Browser": "Chrome", "Device": "Desktop/Laptop", "Country": "Afghanistan", "Language": "English", "Player": "91823781188577408"
The requested result:
{ "Country": "Afghanistan", "Language": "English", "PlayerCount": 120 }
In SQL, this would be something like:
SELECT Country, Language, COUNT(DISTINCT PlayerCount) FROM Table GROUP BY Country, Language
My last attempt at aggregation included $ project, $ group and $ relind of several types, unfortunately, no one worked, and there werenβt so many when adding them. Please note that after a decision based on the aggregation structure, and not with a map reduction, I get a solution.
Thank you very much.
source share