Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2822

com.mongodb.AggregateIterableImpl does not implement toCollection

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • 3.6.3
    • None
    • None

    Description

      With the 3.6.3 Java driver running on Java 8u141, the AggregateIterableImpl returned from the DBCollection.aggregate(...) method throws a NoSuchMethodError when attempting to run the toCollection method. However, the AggregateIterable interface defines this method.

      Compilation of the class is successful. The error appears to only be at runtime.

      Reflection over the class shows the following methods are available:

      • iterator
      • iterator
      • execute
      • first
      • forEach
      • map
      • createBsonDocumentList
      • useCursor
      • into
      • bypassDocumentValidation
      • maxTime
      • batchSize
      • batchSize
      • allowDiskUse

      Example to reproduce:

      AggregateIterable<Document> pipeline = collection.aggregate(stages);
      pipeline.toCollection();
      

      The actual error is:

      java.lang.NoSuchMethodError: com.mongodb.client.AggregateIterable.toCollection()V
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            brianghig Brian Ghigiarelli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: