I have problem with get count by group.
"BOOL_LIST": [
{
"BOOK_TITLE": "the lord of the ring",
"INDEX": 1,
"READ": {
"NORMAL": {
"SN": "12222ea8e679518021f01a19cc4d95b9483c3",
"RESULT": "booked"
},
"bNORMAL": {
"SN": "4444454b51ea8e679518021f01a19cc4d95b9483c3",
"RESULT": "yet"
}
}
},....
I want to get output like below.
[{BOOL_TITLE:"the lord of the ring", NORMAL.booked_count : 2, bNORMAL.booked_count :1},
{BOOL_TITLE:"Mr.porter", NORMAL.booked_count : 21, bNORMAL.booked_count :1}, ...]
I have a problem with using $group. How can I do this?
BOOL_LIST.READis an array. Please see my answer if READ is used as array