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

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -