I have following collections with fields in my mongodb database:
Category cat_id: cat_id_1, cat_name: education cat_id: cat_id_2, cat_name: Sports Keywords key_id: key_id_1, key_name: social key_id: key_id_2, key_name: places Artists art_id: art_id_1, artist_name: Brian Adams art_id: art_id_2, artist_name: ACDC Episodes ep_id: ep_id_1, ep_title: "Episode Title 1", categories: [cat_id_1, cat_id_2],keywords: [key_id_1], program_id: pr_id_1, artists: [art_id_1, art_id_2] Programs pr_id: pr_id_1, pr_title: "Program Title 1", categories: [cat_id_1, cat_id_2],keywords: [key_id_1], program_id: pr_id_1, artists: [art_id_1, art_id_2]
Now I need to write a query which will list programs based on search string matching Category, Artist, keywords, Episodes Title or Program Title. It would have been easy if it's a single collection by just using
$regex and supplying searched string to it. However I failed to apply the same for this condition.