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

Performance of first() could be improved

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: Performance
    • Labels:

      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

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

              Dates

              Created:
              Updated:
              Resolved: