[COMPASS-6159] Export to Language (Java) has incorrect class name Created: 26/Sep/22  Updated: 29/Oct/23  Resolved: 22/Dec/22

Status: Closed
Project: Compass
Component/s: Export to Language
Affects Version/s: None
Fix Version/s: 1.35.0

Type: Bug Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Alena Khineika
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Story Points: 2
Documentation Changes: Not Needed
Sprint: Iteration Quahog, Iteration Ragfish

 Description   

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



 Comments   
Comment by Githook User [ 03/Jan/23 ]

Author:

{'name': 'Alena Khineika', 'email': 'alena.khineika@gmail.com', 'username': 'alenakhineika'}

Message: fix: export to Language (Java) has incorrect class name COMPASS-6159 (#3914)

  • fix: export to Language (Java) has incorrect class name COMPASS-6159
  • refactor: remove bootstrap
  • fix: use imports depending on mode
  • docs: update readme
  • refactor: reformat
  • refactor: make code more readable
  • refactor: remove extra check
  • refactor: eventually for of
Comment by Githook User [ 03/Jan/23 ]

Author:

{'name': 'Alena Khineika', 'email': 'alena.khineika@gmail.com', 'username': 'alenakhineika'}

Message: fix: export to Language (Java) has incorrect class name COMPASS-6159 (#3914)

  • fix: export to Language (Java) has incorrect class name COMPASS-6159
  • refactor: remove bootstrap
  • fix: use imports depending on mode
  • docs: update readme
  • refactor: reformat
  • refactor: make code more readable
  • refactor: remove extra check
  • refactor: eventually for of
Comment by Githook User [ 22/Dec/22 ]

Author:

{'name': 'Alena Khineika', 'email': 'alena.khineika@gmail.com', 'username': 'alenakhineika'}

Message: fix: export to Language (Java) has incorrect class name COMPASS-6159 (#3914)

  • fix: export to Language (Java) has incorrect class name COMPASS-6159
  • refactor: remove bootstrap
  • fix: use imports depending on mode
  • docs: update readme
  • refactor: reformat
  • refactor: make code more readable
  • refactor: remove extra check
  • refactor: eventually for of
Comment by Githook User [ 22/Dec/22 ]

Author:

{'name': 'Alena Khineika', 'email': 'alena.khineika@gmail.com', 'username': 'alenakhineika'}

Message: Merge remote-tracking branch 'origin/main' into COMPASS-6159-fix-export-to-java-class-name
Branch: COMPASS-6159-fix-export-to-java-class-name
https://github.com/mongodb-js/compass/commit/7fd8131893922bfdb1bb88306315ad5be13e1245

Comment by Githook User [ 22/Dec/22 ]

Author:

{'name': 'Alena Khineika', 'email': 'alena.khineika@gmail.com', 'username': 'alenakhineika'}

Message: Merge remote-tracking branch 'origin/main' into COMPASS-6159-fix-export-to-java-class-name
Branch: COMPASS-6159-fix-export-to-java-class-name
https://github.com/mongodb-js/compass/commit/5e178ebc2de42537bb88ff4018dc341ca2380371

Comment by Githook User [ 21/Dec/22 ]

Author:

{'name': 'Alena Khineika', 'email': 'alena.khineika@gmail.com', 'username': 'alenakhineika'}

Message: fix: export to Language (Java) has incorrect class name COMPASS-6159
Branch: COMPASS-6159-fix-export-to-java-class-name
https://github.com/mongodb-js/compass/commit/628d44b02afde73c05b4df468755c7006a2d38fe

Generated at Wed Feb 07 22:42:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.