Aggregations to get counts of different query?


(James Addison) #1

I'm simplifying here, but bear with me. I have two document types: Business and Activity. Activities are owned by Businesses, meaning that an Activity simply has a 'business_id' field. There's no nesting or parent/child mappings here - they are separate document types.

I'd like to get a list of Businesses, each with a count of Activities matching a query - for example, only Activities that start greater than or equal to today. I think this should be possible with Aggregations, but I can't quite figure it out.

Any guidance?


(system) #2