I have a problem. I’ve got the number of words in the title in a new field “numwords”:
After that I’m adding $match in the aggregation pipeline to filter numwords equal to 1:
However there is no output. I’m confused if it’s possible to do $match after $project however
I believe it should work. Possibly I’m doing this a wrong way but I can’t get where I do a mistake.Can you help me please ?
This indicates that there’s a missing bracket, brace or parentheses.
You’re absolutely right ! It was a missing curly bracket. Always getting confused with them !
MongoDB Compass might aide in your pipeline building. Give it a try! Or you could use a text editor that automatically closes off brackets before pasting it into the mongo shell.