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 codeclass 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
Post a Comment