sailsjs waterline combined search for name like '%sam%' from one table and product name like '%nike%' from another table and left join for getting data in terms of user. i know there is no left join in mongo but how to achieve this. i am using mongodb.
var reqData = req.param('q');
console.log(reqData);
// Lookup for records that match the specified criteria
reqData = '%'+reqData+'%';
console.log(reqData);
User.find({ first_name: { 'like': reqData }}).exec(function user(err, user){
if (err) return res.json(err);
console.log(user);
res.json(true);
});
Product.find({ name: { 'like': reqData }}).exec(function user(err, user){
if (err) return res.json(err);
console.log(user);
res.json(true);
});