I have a field in my MongoDB documents called groupKey
.
I want to get back a list of items (easy) but I don't want any groupKey to appear more than 22 times. The total number of documents returned can be many more than 22, however each group (which has a unique groupKey) should only have 22 documents returned.
Is this possible?
I can't seem to find anything that suggests it is, if you can point me to some docs or tell me what to search that would be helpful.