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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -