Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1336

.last/.first should not add _id: 1 sorting in some cases

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: None

      Description

      In case when there any other sorting conditions in current Criteria scope, Mongoid should not add _id: 1 ordering options, on "first" and "last" calls, because this can cause selection without using indexes, and cause performance degradation on large collections.

      Also, I think it will be better use natural ordering instead of just sorting by primary keys, since there no such thing like "first" or "last" record in mongo collections.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: