Final Exam: Question 5 - Did anyone understand what is required to do?

Hi all,

I didn’t understand what is required in exam question 5 AT ALL. Can anyone explain in human language what is asked in this question, please?

1 Like

Does it ask for a pattern of a query to be used in order to get given results?

i think so, about the projection part

The assignment literally states what they want from you:

“NOTE: We are not asking you to consider specifically which documents would be output from the queries below, but rather what fields the output documents would contain.”


Here is how I understood the question;
Of the queries available to choose from which ones produce results such as the example results shown below?

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

In other words, what queries show you results that only contain this info. It isn’t asking you to choose a query that returns only those three title, just queries that return titles.

Hopefully that helps!


On Chapter 2: The MongoDB Query Language + Atlas, Lecture: Projections there are a clue, like say @Christopher_79126, only matters the projections in the query and not the value of the field

Yea I’m pretty sure its just asking what query do you need to write in order to display only the titles of the movies not just the three displayed in the question. Luckly you can just run all those queries in your shell if you can’t figure it out

1 Like

you have to go back and review lesson in chapter 2 when they are talking about projections… Hope that help.
Good Luck …

1 Like

The question is ambiguous.

…which of the queries below would produce output documents that resemble the following.

The number and type of fields is clear, but there are at two other areas of ambiguity:

  1. Is any value for title acceptable, or only non-empty strings? All of the examples have non-empty values, but all of them are strings, so it’s unclear which feature we are being asked to consider. Is "" acceptable as a title? After all, it ‘resembles’ the examples’, in that it’s a string, but not at all, in that it has no length.

  2. Is any number of responses acceptable? You’re probably not asking for exactly three results, but at least one result. Or is zero an acceptable number of results? Consider whether these queries return results if run on the actual handout collection:
    db.movieDetails.find({year: 1968})
    db.movieDetails.find({title: "Muppets in Space"})
    The clarification implies that it doesn’t matter: We are not asking you to consider specifically which documents would be output from the queries, but rather what fields the output documents would contain
    But that naturally leads to the question Would contain, if what? Is it ...if the documents were to exist? or ...if the query is run against the handout collection? No results means no fields whatsoever. Since the question is ambiguous, the diligent student will just to run the actual query against the actual collection and get the answer, but whether the student knows how to run queries is not what the question is attempting to evaluate.

Perhaps, the clarifications of these could be in the question:

Assume that each query will return a result. Which of the queries below will return results containing a single, non-empty field, ‘title’, as in these examples…


Which of the queries below return at least one real example from the handout collection, with a single field ‘title’ of any value, as in the following example…

Each of those are reasonable interpretations of the question, but will lead to different answers.

Can someone explain how and why starting a query with {}, does what it does?

The first argument to find is the filter, the second is the projection (which fields to include). If you want to get every record in the collection but only certain fields for each, you would need to give an empty filter as the first argument, then whatever projections are required as the second