I looked at the lab’s solution and I now understand where I went wrong.
I do have a couple suggestions though… If you are going to use the $regex expression, you really should work it into your aggregation pipeline instruction. It is an art form to learn how to use, but once you understand it, it simplifies it a lot.
Also… Why unwind the $lookuop array so long as I know I will have empty sets? It seems to be a waste of resources.
Also… Group and Sort are blocker stages in the aggregation pipeline. Why what is the advantage of using both when I have already limited my output to four possible answers? Therefore the Sort is redundant in my opinion.
Group yes… Sort no… in my opinion