Code for Mongo aggregations adapted to version 2.12 of the Java API
Private API simplified, QueryResult is not created until needed