-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 3.0.4
-
Component/s: Query Operations
-
None
-
Environment:Java 7
MongoDB server version 3.0.x
When executing an aggregate pipeline, the Java driver gives me a NullPointerException without further explanation.
While debugging I found that it's happening while trying to unbox AggregateIterableImpl.batchSize of type java.lang.Integer to be written to field FindIterableImpl.findOptions.batchSize of type int.
When I specify a batchSize() at the Aggregate other than null, e.g. explicitly setting it to "0" (the documented default value), everything is fine.
So, instead of just using
List<Document> result = collection.aggregate(pipeline).into(new LinkedList<Document>);
I need to write
List<Document> result = collection.aggregate(pipeline).batchSize(0).into(new LinkedList<Document>);
which is rather unusual and smells a bit bad .
I think it would help to change the type of the batchSize attribute of AggregateIterableImpl from java.lang.Integer to int, but I cannot tell whether it has any side-effects...