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

FindIterable.map().first() does not seem to close the underlying cursor

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.8.0
    • Affects Version/s: 3.7.1
    • Component/s: Query Operations
    • None

      With the current MappingIterable.first() implementation:

       

      @Nullable@Overridepublic V first() {
      MongoCursor<V> iterator = iterator();
      if (!iterator.hasNext()) {
      return null;
      }
      return iterator.next();
      }

       

      It seems that the MongoCursor.close() method is not called on a col.find().map().first() call.

      HTH

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            jburet Julien Buret
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: