ruby on rails - MongoDB : Search on multiple keys on embeds documents -
i've translation document embeds many translation locales documents :
class translation include mongoid::document field :key, :type => string embeds_many :locales, :class_name => 'translationlocale' end class translationlocale include mongoid::document embedded_in :translation field :code, :type => string field :state, :type => boolean, :default => false field :text, :type => string end
i want able find translation documents including particular locale in given state.
translation.where('locales.code' => 'en', 'locales.state' => false).all
the problem query translation documents embedding locale code=en , locale state=false not on same sub document.
any appreciated, thank you!
Comments
Post a Comment