Refactor LocalCollection._makeLookupFunction

Based on a lot of experimentation about how Mongo handles arrays,
numeric indices, and nulls.

Also sets the groundwork for update modifiers with "foo.$.bar" by
tracking arrayIndex during lookups.

Adds a few expected_fail tests for where I found behavior that differed
from Mongo.

Some of this behavior seems to have changed between (stable) Mongo 2.4
and (unstable) Mongo 2.5.  In the interest of future-proofing, I have
preferred the 2.5 behavior.
Fix an old comment.
Factor sort code into its own file.
Some updates to our NOTES file.
refactor: _compileSelector results {result:bool}

instead of just a bool.  This will give us room to add arrayIndex (and
perhaps to get the geoquery distance stuff into a better place).

This is just a very surface refactoring: it doesn't even extend to the
"value selectors" yet.
Minor refactoring in compileDocumentSelector
Implement $comment

It's a top-level logical operator that is ignored.
Support "obj" name in $where
refactor: logical operators use structured return
Drop unused arg from logical operator compilation
Refactor logical ops; better error for non-object