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

with_size doesn't seem to achieve the desired result

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
      None

      Description

      Using mongoid (3.0.23)

      I have this on my User model:
      field :items, type: Array, :default => []

      I am trying to find users with items.length > 1:
      User.where(:items.with_size => {:'$gt' => 1}).desc(:'items.length').limit(10)

      This doesn't seem to work. I get results as if the condition is ignored altogether.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            emirkin Eugene Mirkin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: