I am using Loopback node js framework with MongoDB. Here I am checking if a field contains a given string or not
user.find({
where: {
or: [{
mobile: {
"regexp": '/' + data.search + '/i'
},
contacts:{
"regexp": '/' + data.search + '/i'
}}]
}
}, function(err, mobileResult) {
if (err) {
callback(err, null);
} else {
.......
.......
}
});
this one works with string type field contacts
but not with number field mobile
.
I tried answers from these post but it didn't worked for me.