mongodb - How to query username from userId in a collection in Meteor? -
i trying implement basic search bar functionality in app. i have bunch of articles, , has owner. specified userid in user parameter of each article. right can search keywords within article, title, , date. want able query username of author of article, have userid available me... var keyword = session.get("search-query"); var query = new regexp( keyword, 'i' ); var results = articles.find( { $or: [{'user': query}, // searching userid of author! {'title': query}, {'articletext': query}, {'datetime': query}] } ); return {results: results}; i'm not sure how this... welcome non-relational databases! you're coming rdbms environment expect joins. there none. store username in article belongs to, yes, if user change username, you'll need loop through collection , update username _id matches. please here mongo strategies (thi...