我的网址是 http://localhost:3000/API/GetEvents?search=prueba
我的回答是 []
这是我的代码
var query = req.param("search");
console.log(query);
Event.find({name: /query/}).sort({ created_at: 'desc' }).populate('moderator').exec(function (err, events) {
if (err) throw err;
var response = [];
events.forEach(function (ev) {
var moderatorName = ev.moderator.facebook.name;
if (ev.isFanPage)
moderatorName = ev.fanPageName;
response.push({ eventId: ev._id, title: ev.name, description: ev.description, thumb: ev.thumb, moderator: moderatorName, moderatorFbId: ev.moderator.facebook.id, countPicture: '1', countVideo: '1' });
});
next(response);
});
我的搜索参数是req.param(“搜索”)并在我的查询中包含查找参数。
因为它应该搜索该字段?