Chapter 4: Lab 2: syntax error near unexpected token

Hello, I am getting frustrated, I don’t know what I am doing wrong here. This is my code:

db.companies.find(
{
  "$and": [
    {
      "$or": [{ "founded_year": 2004 }, { "founded_month": 10 }]
    },
    {
      "$or": [{ "category_code": "social" }, { "category_code": "web" }]
    }
  ]
}
).count()

This gives an error: syntax error near unexpected token `{’. I don’t know what typo I did? Could anyone please help? Thanks!

I restarted the connection with the IDE and that solved the problem. However, I am still wondering what causes such errors, to never happen that again. Thanks!

Hi @Lisette_Bouwmeester, welcome to the community :wave: .

I have reformatted your query, and it looks good to me. Let us know if you come across this error again.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

1 Like