I am trying to implement a basic search bar functionality in my app.
I have a bunch of articles, and everyone has an owner. This is specified by the userId in the user parameter of each article.
Right now I can search for keywords within the article, the title, and the date. However I want to be able to query for the username of the author of the article, but I only have the userId available to me...
var keyword = Session.get("search-query");
var query = new RegExp( keyword, 'i' );
var results = Articles.find( { $or: [{'user': query}, // this is only searching userId of the author!
{'title': query},
{'articleText': query},
{'datetime': query}] } );
return {results: results};
I'm not sure how to do this...