I have a RethinkDB table where the docs look something like this:
[
{ "date": Mon Oct 05 2015 19:30:00 GMT+01:00, "category": 1, "name": "Alice" },
{ "date": Wed Oct 07 2015 14:00:00 GMT+01:00, "category": 2, "name": "Ben" },
{ "date": Mon Nov 16 2015 12:30:00 GMT+01:00, "category": 1, "name": "Charles" },
{ "date": Sun Nov 01 2015 22:15:00 GMT+01:00, "category": 1, "name": "Donald" }
(...)
]
I am trying to write a query to group my data by month / year, then (within each group) into categories, and then do some aggregation by subgroups.
Based on the example provided in the ReQL docs ( https://www.rethinkdb.com/api/javascript/group/ ), this gives the first step:
r.table("seances").group([r.row("date").month(), r.row("date").year()])
I'm stuck here. A chain with group(r.row("category"))gives an error message (cannot cause groupoutput group). Calling ungroupup to the second groupdoes not work either.
Any idea how this can be done? (ReQL looks very powerful, but very different from what I'm used to with lodash ...).