DATAMONGO-2148 - Add query logging for MongoTemplate.count(…).

Original pull request: #620.
This commit is contained in:
Cimon Lucas (LCM)
2018-11-16 18:55:53 +01:00
committed by Mark Paluch
parent 28d96f5fe2
commit 6c0dd2c80e

View File

@@ -1124,6 +1124,10 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
protected long doCount(String collectionName, Document filter, CountOptions options) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Executing count: {} in collection: {}", serializeToJsonSafely(filter), collectionName);
}
if (MongoDatabaseUtils.isTransactionActive(getMongoDbFactory())) {
return execute(collectionName, collection -> collection.countDocuments(filter, options));
}