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

Performance of first() could be improved

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.0.0
    • None
    • Performance

    Description

      Performance testing has shown that the new first() method on the CRUD API is not very performant if there are documents in the database that match the search criteria but are not needed.

      For example:

      result = collection.find().first();

      Will fetch all the first batch of results from the server, when the user only really wants the first one.

      I suggest the "first" method adds a limit to bring the performance up to something more inline with the 2.x driver.

      Attachments

        Activity

          People

            ross@mongodb.com Ross Lawley
            trisha.gee@10gen.com Trisha Gee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: