Mongo query to return distinct count, large documents

I need to be able to get a count of distinct ‘transactions’ the problem I’m having is that using .distinct() comes back with an error because the documents too large.

I’m not familiar with aggregation either.

I need to be able to group it by ‘agencyID’ as you see below there are 2 different agencyID’s

enter image description here

enter image description here

I need to be able to count transactions where the agencyID is 01721487 etc

I’ve tried this but it doesn’t work for me.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.