Hi all,
I’m having trouble with an easy to explain but thus far difficult to achieve (for me) aggregation task.
I have a Bills collection that looks like this:
What I’d like to do is group all the payments with BillDate = some date by the BilledTo.Name.
For example for 2022-02-01 I might get something like:
{
"Steve's Rad Brokerage": [
A payment object,
Another payment object
],
"Some Other BilledTo.Name": [
Yet another payment object
]
}
I have gotten a good amount of the way there with unwind and a simple match, but getting the resulting payments to group by BilledTo.Name is turning my brain inside out.
Thanks @steevej! This works great and has provided a nice framework to do a few fancier things with the data. FYI I am using the native date type, just easier to show as a string here