I have a table called "Stat" in my MongoDB database in Rails 3.
This table has an array field called "services".
I want to find all Stats that have an array of services that contains the value "lights".
I want to do something like this:
@stats = Stat.all
@stats1 = @stats.where("services contains lights")
Rails.logger.info "result: #{@stats1.count} "
I tried different things and looked for it many times, found several potential customers, but nothing works. I have four records that should match this query, but the above returns a null set.
I want to do this in rails 3 / mongo?
source
share