Push filters down to MongoDB.

Improve testing and tracing for queries that are generated to be executed on third-party systems such as MongoDB.