I need a mongoid search like query with INTEGER COLUMN. For example:
SELECT * FROM users WHERE mobile LIKE '%9980%';
Here is the my model:
class User
include Mongoid::Document
include Mongoid::Timestamps
##
# Columns
field :name, type: String
field :mobile, type: Integer
end
I already tried following examples. But no luck :(
User.where(:$where => "/^#{params[:mobile]}/")
User.any_of({mobile: /.*#{params[:mobile]}.*/i})
User.where(mobile: /8801/))
How to write it with mongoid?