Fix selectors matching against arrays containing subdocuments.

This is a 0.5.5 regression (with the new selector compiler): the new compiler
handled selectors with "a.b.c" reasonably well if the "c" level contained an
array but not if the "a" or "b" levels did.

This also implements mostly-Mongo-compatible behavior for sorting when arrays
are involved; this is not an 0.5.5 regression, since the old compiler did not
get this right.