M201 - chapter 4.2 - lab 4.2.2

Chapter 4.2: MongoDB Indexes

Lab 4.2.2: Optimizing Compound Indexes


I need some help with the lab.

I find it hard to decide which index best suits all the queries.

It seems that every query is best served by a different index so there is no one particular index that serves all.

At first glance I thought the best compound index that would fit would be address.state and job or maybe address.state job and first name.

Both answers are wrong and I would appreciate it if you could explain why.

Thanks, Shirley

You will have better chance to have meaningful answer by using the M201 forum from MongoDB university.

Could you please point out where the forum is? Thanks in advance!

You need an index which is used in all the stages i.e. in both the fetch stage and the sort stage.

Also, you can find the MongoDB discourse forum here.

Thank you :slight_smile: