ruby on rails - Search over multiple key of field type hash MongoID -


i apply filter on multiple key of field type hash reference example code below

######working code
class model   include mongoid::document    field :ld,    as: :load_date,       type:time   field :cls,   as: :classification,  type:hash    def self.base_filter(filters)     model.where("cls.#{filters}.r"=>true,"cls.#{filters}.t"=>"news",:load_date.gte=>1.month.ago).count   end end 
######desired not working code
class model   include mongoid::document    field :ld,    as: :load_date,       type:time       field :cls,   as: :classification,  type:hash    def self.base_filter(filters)     model.where("cls.#{filters}"=>{'r'=>true,'t'=>"news"},:load_date.gte=>1.month.ago).count   end end 

is there available in mongoid or if available in mongodb how can call mongoid


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -