Performance of first() could be improved

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.0.0
    • Affects Version/s: None
    • Component/s: Performance
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

              Assignee:
              Ross Lawley
              Reporter:
              Trisha Gee (Inactive)
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: