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

max not working on scope with any_in + sort

      scope :sent, any_in(state: [:sent]).desc(:sent_at)
      Order.sent.max(:number)

      This query raises Moped error:

      v3.0.23 - failed with error 15876: "could not create cursor
      v3.1.2 - failed with error "no such cmd: aggregate"

      This one works:

      Order.any_in(state: [:sent]).max(:number) # => 88.0

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

              Created:
              Updated:
              Resolved: