Returning 0 Count

In the excersice that ask how many movies with 2 awards wind and 2 awards nomination when I typedb.movieDetails.find({"awards.wins": 2, "awards.nominations": 2}).count(), the system returns 0 as a result. I went trough the steps until I reached the ‘use movieDetails’ step.

1 Like

The mistake you have done is you typed ‘use movieDetails’
which is wrong since there is no db called movieDetails.

To Fix your problem:

We have a db called ‘video’ that has ‘movieDetails’ collections.

Try this and it should work:

  1. Make sure you are connected to Sandbox cluster
  2. type: use video
  3. type your query: db.movieDetails.find({"awards.wins": 2, "awards.nominations": 2}).count()

it should return 12

Hope it helps!

2 Likes

It worked as you said. Thanks.

1 Like

55%20PM

still not working for me

Make sure you are connected to correct cluster
I think you connected to class cluster
Make sure your collection exists before you fire your find command

See the difference here:

Class:
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use video
switched to db video
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show collections
movies
MongoDB Enterprise Cluster0-shard-0:PRIMARY> exit

Sandbox:
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use video
switched to db video
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show collections
movieDetails
moviesScratch

1 Like