How to filter data with crossfilter.js?

How to filter data with crossfilter.js?
0

#1

if i have collection with name, age
how to filter it so i can show how much there is of same age
age count
25 3
10 2


#2

I did this in this way cause after doing ~same thing with
.group().all()
it’s not sorted
I want it sorted by count ( by count i mean it count by same ages )

count var is created in reduceInitial and used in orderValue function to order by count
but think that this is slow cause there is more looping

var countAll = crossfilterCollection.dimension(function(d) {return d['age'] })
 .group( )
 .reduce(reduceAdd, reduceRemove, reduceInitial)
 .order(orderValue).top(Infinity);