-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Export to Language
-
None
-
2
-
Iteration Quahog, Iteration Ragfish
-
Not Needed
Problem Statement/Rationale
The code generated when exporting an aggregation to a pipeline is incorrect for the Java driver, when selecting "Include Driver Syntax".
Steps to Reproduce
Create any aggregation pipeline in the UI. Export to Language. JAVA. Check both Include Driver Syntax and Include Import Statements.
h3. Expected Results
The generated code includes:
AggregateIterable<Document> result = collection.aggregate(Arrays.asList(new Document("$count", "string")));
Actual Results
The generated code includes:
FindIterable<Document> result = collection.aggregate(Arrays.asList(new Document("$count", "string")));
but this won't compile, because the aggregate method returns an AggregateIterable not a FindIterable.
It's also not strictly speaking a "result", because after executing that line of code no commands have yet to be sent to the server. It's not until you call a terminal operation on the Iterable (cursor, into, first) that anything actually happens.
Additional Notes
From this community post: https://www.mongodb.com/community/forums/t/java-code-generated-by-compass-does-not-work/189723/3