Lib fixes updated

Add some fixes so that the library passes all of the tests from https://github.com/Akkroo/MongoQueryTests/commit/60ca2ba1543fd738e46e43c9f60c8563271f329a. Once the JSON fixes are merged (https://github.com/Akkroo/MongoQueryTests/pull/1), I can update the MongoQueryTests submodule.

This pull request does not include changes for running the tests, though they all pass using the committed MongoQueryTests submodule. I will submit a pull request to enable support for running tests when we have decided how best to include the vendor libraries in the repository.