SERVER-13104 enumerate all possibilties for $or below an $and

(cherry picked from commit aac8ba84d8fac7dc531a03c63224fdfc8cd3baa3)
Merge remote-tracking branch 'upstream/v2.6' into v2.6