1.

Point out the correct statement.(a) If you only ever query on a single key in a given collection, then you need to create just multikey index for that collection(b) If you sometimes query on only one key and at other times query on that key combined with a second key, then creating a compound index is more efficient than creating a single-key index(c) The choice between creating compound indexes that support your queries or relying on index intersection is independent of specifics of your system(d) None of the mentionedI had been asked this question in an internship interview.My enquiry is from Indexing Strategies topic in division Index/Indexing Concepts of MongoDB

Answer»

The CORRECT answer is (B) If you sometimes query on only ONE KEY and at other times query on that key combined with a second key, then creating a compound index is more efficient than creating a single-key index

For EXPLANATION: MongoDB will use the compound index for both queries.



Discussion

No Comment Found

Related InterviewSolutions