Imagine that you have this document:
First we want to project to a document that has an additional field we need: day of the week.
I broke it up into steps so that you can see how I came up with an incredibly long and complex expression - it's the kind of thing that I could never get all the parenthesis to match up correctly if I didn't do it programmatically, or in sequence of simple steps. I'm also saving the last step into a variable that I will use in my final pipeline.
Meanwhile, let's look at what 'dayOfWeek' expression actually looks like: