Question 5 marked incorrectly

Hey @Kanika,

I’m sure you’ve heard it all before, but I’m kind of confident that question 5 on the exam is scored incorrectly.

There are two options shown in the answers that provide the correct projection, but one of the options includes a filter for a very specific year. However, the question shows three example films from widely ranging eras of cinema, which are definitely not from the same year.

So… that’s why I picked the one without a year filter. But the exam counts it as wrong :slight_smile:

I agree. Same here…

If you read the problem:

Using the video.movieDetails collection, which of the queries below would produce output documents that resemble the following. Check all that apply.

You can easily understand that you must check all the answers that would throw results like the shown in the problem. Let’s go to the pattern:

{ "title" : "P.S. I Love You" }
{ "title" : "Love Actually" }
{ "title" : "Shakespeare in Love" } 

So the query should return this kind of output. Now let’s check the options:

db.movieDetails.find({title: “Muppets from Space”}, {title: 1})

This solution would bring the _id with it, so we don’t check it.

db.movieDetails.find({year: 1964}, {title: 1, _id: 0})

Although the filter could make it seem strange, it’s important to focus on the problem. Would this query bring the data in the given pattern? If you check in your Mongo console or in Compass, then you would see that this answer is correct. Let’s keep moving.

db.movieDetails.find({title: “”}, {title: 1})

Again, brings the _id. Don’t check this one.

db.movieDetails.find({}, {title: 1, _id: 0})

This one doesn’t have a filter, but still, the format accomplishes the given pattern. You selected this one, right?

db.movieDetails.find({}, {title})

Right now I am away from my computer so I can’t give a proper info but I think this will bring a syntax error. Anyway, it doesn’t block the _id.

db.movieDetails.find({}, {title: 1})

We have a lot missing the _id block. This one is the same as the other ones. It brings the title but doesn’t block the _id.

That’s all! Hope it helps! Your mistake was in the second one. But don’t worry! Take this as an opportunity to grow and keep learning!

1 Like

Blegh… Of course, you are absolutely right.

I got so hung up “these movies weren’t made in 1964” that I forewent the possibility that the year was simply entered into the database incorrectly. And then yes, the query would definitely produce the output shown.

1 Like