Chapter 2: The MongoDB Query Language + Atlas Reading Documents: Scalar Fields

Quiz: Problem:

Explore the movieDetails collection that you loaded into your Atlas sandbox cluster and then issue a query to answer the following question. How many movies in the movieDetails collection have exactly 2 award wins and 2 award nominations?

You will find the count() method useful in answering this question using the mongo shell.

The query filter did not yield the desire result. I’m getting error messages. Need help

Hi there,
I am seeing the same behavior too. I think the query might not be valid anymore. I am still trying to find a way to get expected output.

Thanks. I hope someone else has a solution. We are still within allotted week for this chapter.
2. Attempt to filter movie rating in compass {mpaaRating: “PG-13”} returned 0 document. 3. Same no documents return in Shell using db.movies.find({mpaaRating: “PG-13”}).pretty()
I’m connected to the same cluster.

Hi,I think your problem is “not use quotes for the key of query filter” .Try as this: find({“a.b.c”:2})

1 Like

when the filter is a embed document, like a.b, as the key ,must surround by quotes

Thanks Bailei. filter embedded with quote yet no return

Is Shanon available to answer us? something is not right with Atlas. look at the picture.

I followed exactly as it says in the solution but nothing works.

1 Like

Hey @Basit_31825, I think there is a promble with Compass, I wish I had more knowledge of this front-end GUI.
The good news is it worked with the mongo shell. here is how you can do it:

  • connect to the your Sandbox
  • type use video
  • list your dbs, you should see that you have all these tables show tables

movieDetails
movies
moviesScratch

  • db.movieDetails.find({"awards.wins": 2, "awards.nominations": 2}).count()
    should output: 12

Good Luck.

Pro tip, reboot or reset you network connection on you machine.

1 Like

MongoDB Enterprise Cluster0-shard-0:PRIMARY> use video

switched to db video

MongoDB Enterprise Cluster0-shard-0:PRIMARY> show collections

movieDetails

moviesScratch

MongoDB Enterprise Cluster0-shard-0:PRIMARY>

I’m missing video in my collections.

@Basit_31825 video is the database name so it won’t show as a collection.