Unable to find error in query

I am giving this query in ide for chapter-4 lab 2 problem
db.companies.find({“$and” : [{"$or": [ {“founded_year”:2004}, { “founded_month”:10} ]},
{"$or": [{“category_code” : “social” }, {“category_code” : “web” } ]}]} ).count()

I am getting this error .
2021-07-06T07:23:52.061+0000 E QUERY [js] SyntaxError: illegal character @(shell):1:19.

I also tried
db.companies.find({"$or": [ {“founded_year”:2004}, { “founded_month”:10} ]},
{"$or": [{“category_code” : “social” }, {“category_code” : “web” } ]} ).count()

and got 0 as answer which was wrong. Please help. Is use of $and here reduntant. I am very confused.

Hi @Dhruv_Bakshi,

Kindly check the curly braces and parentheses in your first query. And if you can kindly elaborate what you mean by is use of $and here reduntant.?

Thanks,
Kushagra

Hi @Kushagra_Kesav
Thank you for the respone.
'is use of $and here redundant ’ by this I was trying ask that am I using , alongwith $and operator which is causing some sort of redundancy which is ultimately causing error.

Hi @Dhruv_Bakshi,

No, it doesn’t seem like that!!

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

Check out the query above. And kindly use the proper formatting tools to avoid braces errors.

Thanks,
Kushagra