Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-6159

Export to Language (Java) has incorrect class name

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.35.0
    • Affects Version/s: None
    • Component/s: Export to Language
    • None
    • 2
    • Not Needed
    • Iteration Quahog, Iteration Ragfish

      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

            Assignee:
            alena.khineika@mongodb.com Alena Khineika
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: