mongoid/mongoid — Issue #1335: .last/.first should not add _id: 1 in some cases
Author: y8
Created: 2011-10-08 19:51:07+00:00
State: open

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.