Hi Everyone,
the test UsingAggregationBuilders.aggregateSeveralStages() fails because the order of the results are not equal. The ordering of attribute count is of course correct but the order of _id (here cast-name) is different.
expected:
<[Document{{_id=Leonor Silveira, count=8}}, Document{{_id=Joaquim de Almeida, count=6}},
Document{{_id=Isabel Ruth, count=6}}, Document{{_id=Maria de Medeiros, count=5}},
Document{{_id=Catherine Deneuve, count=5}}, Document{{_id=John Malkovich, count=5}},
Document{{_id=Ricardo Trèpa, count=5}}, Document{{_id=Joèo Cèsar Monteiro, count=5}},...
but was:
<[Document{{_id=Leonor Silveira, count=8}}, Document{{_id=Isabel Ruth, count=6}},
Document{{_id=Joaquim de Almeida, count=6}}, Document{{_id=Joèo Cèsar Monteiro,
count=5}}, Document{{_id=Maria de Medeiros, count=5}}, Document{{_id=Ricardo Trèpa,
count=5}}, Document{{_id=Catherine Deneuve, count=5}}, Document{{_id=John Malkovich,
count=5}},...
it looks like the second attribute is ordered differently (natural vs random?)
the size of the collection is the same.
any hints?
greetings
edit:
its the same issue as discussed in UsingAggregationBuilders.aggregateSeveralStages assertion fails
the solution/workaround is: change the type of “sortByCountResults” and “groupByResults” from ArrayList to HashSet and it will work.
this topic can be closed. thanks