I have a table called " Stat " in my MongoDB database in Rails 3 .
In that table, there is an array field called "services" .
I want to find all Stats that have a services array 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've tried various things and Googled it extensively, found some leads but nothing that seems to work. I have four records that should match this query but the above returns a zero set.
Is what I want to do possible in rails 3 / mongo ?