Which is the best query to get distinct counts of large sets of data?
Usually, we come across 16 mb limit error for distinct queries whether it is direct distinct query or an aggregation with $addtoSet to get the distinct counts. Is there any way to avoid this so that we can run it on large data sets?
An aggregation with $sortbycount is all that is needed.
1 Like