M201 Chapter 2 Quiz - Incorrect Answer

Hi M201 Courseware Folks,

In M201 the following quiz lists only the top answer as correct. I believe that the second answer should also be correct, If there’s an index on one of the fields for an exact match query it will first do an index scan on the indexed field and then a scan of those documents to match on the second unindexed field.

Is this correct? If not, why?

That is not my understanding. An index only contains the indexed fields and some magic number that locate the document inside the collection.

A simple test seems to prove otherwise unless I’m missing something.

I created an index {title:1} on the sample_mflix.movies
lastupdated is not indexed.

The explain plan uses an index scan on title which returns 2 documents, and then fetches the 1 document that matches on the lastupdated field

Would the find() command would yield different results/have different behavior behind the scenes than what I assume is a $match agg pipeline being sent through Compass behinds the scenes?

Your query includes the indexed field.

:man_facepalming: Duh, for some reason I thought Zip was one of the included fields. Thanks