DATAMONGO-1096 - Use null-safe toString representation of query for debug logging.

We now use the null-safe serailizeToJsonSafely to avoid potential RuntimeExceptions during debug query printing in MongoTemplate.

Based on original PR: #247.

Original pull request: #251.