Simplify boolean expressions

Within the WHERE clause, you can specify multiple comparisons combined
with boolean operators, like so:

a = 1 AND b > 2 AND c < 3 AND d = 4

If the operators are all the same, it makes sense to combine them in the
Mongo query. Is Mongo more performant running {$or: [this, that, other]}
than {$or: [{$or: [this, that]}, other]}? I dunno. It seems like it
would, but "seems like it would" and Mongo live in different states.

This commit combines like boolean trees into simpler forms in MongoDB
queries.