mongodb - Should I make a compound index for this query? -


say have collection 1 million documents ones below:

{    email: "test@test.com",    survey: objectid('whatever'),    taken: date(1/1/2015) }, {    email: "blah@blah.com",    survey: objectid('whatever'),    taken: date(6/1/2015) } 

if going going execute query 1 below often:

db.participants.find({survey: objectid('whatever')}).sort({taken: 1}) 

how important me include taken in index? typically record set go down 1 million 30 based on survey query , 30 records sorted.

does still make sense index column though filtered set sorted smaller?


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -