I cannot be sure, but I don't think this functionality exists. I think you are looking for custom grouping functions, something that came up in a different post we made a while back. Kinvey recommended utilizing a custom endpoint for these kind of complex queries.
CustomEndpoint collectionAccess module has mapReduce(map, reduce, options, callback) method - so my endpoint will just pass incoming map parameter in mapReduce method. I thought it might be already done by API.