I am trying to solve this lab. To get started I wanted to solve for the first portion, identifying the companies founded in 2004 and that have the “category_code” of either “web” or “social”. I am using this but when I enter it in the IDE or in the terminal on my computer it just generates an ellipses and ends, I don’t get any results. Anyone able to help me understand the error in my query?
The ellipses is the secondary prompt of the shell. The secondary prompt is printed to indicate you that the command you are entering is not terminated. The usual cause is missing parenthesis, braces or brackets. In the above, the closing parenthesis of find( is missing. Also take a look at https://docs.mongodb.com/manual/reference/operator/query/and/ because your $and has not the correct syntax.
Your brackets are all wrong. The closing bracket after
is terminating the array of $or clause. That is not what you want.
The mongo shell and new mongosh are JS based. Simplify your query using variables. When you do everything becomes clear. Otherwise it is a mess of braces, brackets and parenthesis. For a query like this problem I would: