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

array selector fails on embedded document

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

      class User
      	include Mongoid::Document
      	embeds_many :profiles
      end
      
      class Profile
      	include Mongoid::Document
      	embedded_in :user
      	field :likes, :type => Array
      end
      
      User.last.profiles.create(:likes => ["red","orange"])
      User.last.profiles.where(:likes => ["red","orange"]).count
       => 0
      

      This example should work, but results in count => 0

      class Profile
      	include Mongoid::Document
      	field :likes, :type => Array
      end
      Profile.create(:likes => ["red","orange"])
      Profile.where(:likes => ["red","orange"]).count
       => 1
      

      This example works correctly however

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

              Created:
              Updated:
              Resolved: