I’m trying to create a query in Mongo that is similar to the following in SQL:
@issues = Issue.where("content like ?", "%#{params[:q]}%")
But in Mongo when I use “where” I get ALL the results. When I use “find” I get NO results. Here is what I am running, which is not working:
@issues = Issue.where({content: "/^#{params[:q]}/" })
I just want to return items matching the letters entered into my query. I am using MongoDB through Mongoid.
Thanks!
Can you try? It should work if it works for the former case