I need to query mongodb use 'like' clause (as in sql) for number data type. At the glance my problem is similar to this question:
How to query MongoDB with "like"?
The solution given there works perfectly for string datatype since it uses regex. However it not works if the field that need to lookup is number.For example below, the userId field of users collection has data type number and such query can get result as I expect.
// This is not working
db.users.find({"userId": /.*8788.*/})
I have tried to google and skim mongodb documentation but cannot find any solution yet.