Please Give More Hints to Ch1 Lab Computing Fields

Hi,

I managed to compute the number of words of the title using $project – without doing any validation as hinted in this thread.

The part where I need to filter just 1 word movie titles elude me. If this is done using $match - I’m stuck. Any hint so I can continue.

Thank,

Ben

Hi,

You could use $split and $size as suggested. If a title contains more than one word, if you split using a blank space you would get an array of length greater than 1. So if you split the title and project the result, you can use the $size on the new title (which is now an array) in the next stage to filter out the movies with more than one word in the title.

Hope this helps.

José Carlos

1 Like

@jcarlosgarcia Thank you very much for the hint. It didn’t sink in the first two (2) times I read it. The 3rd’s the charm, I guess. I don’t even have to force myself to code the correct syntax.

I also understand more about $project - that it can literally change a field or fields along the way. Also, $match can be use after $project.

Thanks.

Glad to help!

José Carlos