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

Default $orderby _id:1 on where() causing HUGE performance issues

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

      On Mongoid 4 / Moped 2 stable, I am seeing crazy performance issues when $orderby:

      { _id: 1 }

      is used on a where statement that is doing an $or and looking for a single record. With $orderby its 40 seconds, without it, the same query goes to 1ms.

      I checked all of my code and I am not setting a default scope to order by _id anywhere.

            Assignee:
            Unassigned Unassigned
            Reporter:
            pkieltyka Peter Kieltyka
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: