How to write group by query in mongo db redash

hi,
i want to write a query where i can get a number of records from the student table group by year.

in sql
select count(*) from student group by year

tell me how to write it in mongodb redash

Thanks

here is the solution -:

{
"collection": "student",
"aggregate": [{
	"$unwind": "$YEAR"
},
{
	"$group": {
		"_id": "$YEAR",
		"count": {
			"$sum": 1
		}
	}
}]
	
}

Thanks for posting your solution!