Skip to content

Instantly share code, notes, and snippets.

@benedikt

benedikt/gist:5859066

Last active Dec 18, 2015
Embed
What would you like to do?
Is this a mongoid bug or a feature?
Model.elem_match(:embedded => { :a => 1, :b => 2 })
# => #<Mongoid::Criteria
# selector: {"embedded"=>{"$elemMatch"=>{:a=>1, :b=>2}}}
# options: {}
# class: Model
# embedded: false>
Model.elem_match(:embedded => { :a => 1 }).elem_match(:embedded => { :b => 2 })
# => #<Mongoid::Criteria
# selector: {"embedded"=>{"$elemMatch"=>{:b=>2}}}
# options: {}
# class: Model
# embedded: false>
@cpuguy83

This comment has been minimized.

Copy link

@cpuguy83 cpuguy83 commented Jun 25, 2013

I would expect that to be expected behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment