M001, Chapter 4, Lab 2

Following one is giving me output as 149
db.companies.find({"$and":[{"$or":[{“founded_year”:2004},{“founded_month”:10}]},{"$or":[{“category_code”:“web”},{“category_code”:“social”}]}]}).count()

however the following one which I have written giving me the output 0
db.compnaies.find({"$and":[{"$or":[{“founded_year”:2004},{“founded_month”:10}]},{"$or":[{“category_code”:“web”},{“category_code”:“social”}]}]}).count()

both MQL are exactly same what is issue then?

You have spelling mistake. The collection name is wrong.

4 Likes

Hello Shrikrushna,
Firstly, welcome to MongoDB!

Secondly, it does appear that you have the wrong collections name.

As in your first example you are using:
db.companies.find

Where it should say:
db.companies.find

It’s just a simple spelling mistake is all. The rest of that query works.

If there is anything else that I can assist you with, feel free to let me know!

-Brock

I will may be sound rude but I need to write it.

Is it possible to reduce the number of post by not repeating a solution that was already proposed?

Here we have

and then 7 days later:

There is a lot of traffic and opening a post just to read a duplicate solution is slowing everybody.

Another example of this, from another thread:

and then 4 days later

Thank you for not taking that personally.

1 Like

Hi @steevej,

I totally understand your concern regarding the duplicacy of the already proposed solution.
We appreciate your feedback and will forward these to all the concerned team and make sure we don’t indulge in anything like this in the future.

Kind Regards,
Kushagra

1 Like