-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
class Subdoc include Mongoid::Document embedded_in :foo field :a field :b end class Foo include Mongoid::Document embeds_many :subdocs end f = Foo.new f.subdocs.new(:a => 1, :b => 1) f.subdocs.where(:a => 1).first => #<Subdoc _id: 57912b932774e24d68ce123f, a: 1, b: 1> f.subdocs.where(:$elemMatch => {:a => 1}).first => nil
I know that matches? isn't a full implementation of the MongoDB query evaluation engine, but this is fairly easy to support: