i am using rails and mongo db as database simply i want to search I have a field name role Now i send the search item in
params[:role]
params[:name]
Now i have the model User now what could be my query to search the data in the User model like params[:name] I did like
@role = params[:role]
@name = params[:name]
@data = User.{where(:role => @role)}.where("description LIKE (?)",
"%# {@name}%").desc(:created_at).
excludes(:id => current_user.id)
Above query is just analysis. I mean to say it should like in therotical but i didnt get id.