DATAMONGO-1397 - Log command, entity and collection name in MongoTemplate.geoNear(…).

Original pull request: #348.
This commit is contained in:
Mark Paluch
2016-03-15 16:22:48 +01:00
committed by Oliver Gierke
parent 2687cb85f0
commit a7cda2e793

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 the original author or authors.
* Copyright 2010-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -138,6 +138,7 @@ import com.mongodb.util.JSONParseException;
* @author Chuong Ngo
* @author Christoph Strobl
* @author Doménique Tilleuil
* @author Mark Paluch
*/
@SuppressWarnings("deprecation")
public class MongoTemplate implements MongoOperations, ApplicationContextAware {
@@ -664,6 +665,11 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware {
command.put("query", queryMapper.getMappedObject(query, getPersistentEntity(entityClass)));
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("Executing geoNear using: %s for class: %s in collection: %s",
serializeToJsonSafely(command), entityClass, collectionName));
}
CommandResult commandResult = executeCommand(command, this.readPreference);
List<Object> results = (List<Object>) commandResult.get("results");
results = results == null ? Collections.emptyList() : results;