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

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

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.0
    • Affects Version/s: None
    • Component/s: None

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            y8 y8
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: