For optimal performance, if you provide both a sort
and a query
to the MapReduce, should you have:
one index with fields used in the sort, then the fields used in the query
one index with fields used in the query, then the fields used in the sort
two separate indexes
E.g. document contains fields A, B, C, D
.
Map-Reduce is using a sort on field A
and a query by fields B, C
.
Which of the following indexes would be preferable:
{ "A" : 1, "B" : 1, "C" : 1 }
{ "B" : 1, "C" : 1, "A" : 1 }
{ "A" : 1 }
,{ "B" : 1, "C" : 1 }
Is this documented anywhere? (Index usage by map-reduce when using both sort and query.)