Aggregation Pipeline Returning Empty Array

This is quite abnormal.

If

works, then

should work.

May be useShuffle is false and the aggregation is not even called.

The call to aggregate() returns a cursor. Do you call toArray() or something similar to get the documents from the cursor?