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

Can't use $not in embedded document querying

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0
    • Affects Version/s: 5.0.1
    • Component/s: None
    • None

      class Foo
        include Mongoid::Document
        embeds_many :bars
      end
      
      class Bar
        include Mongoid::Document
        embedded_in :foo
      
        field :name, :type => String
      end
      
      f = Foo.new
      f.bars.build(:name => "Building")
      f.save()
      irb(main):018:0> f.bars.where(:name => /build/).count
      => 0
      
      # I would expect this to match but it does not
      irb(main):019:0> f.bars.where(:name => {:$not => /build/}).count
      => 0
      

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            jonhyman Jon Hyman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: