java - how to show query while using query annotations with MongoRepository with spring data -
i'm using mongorepository in spring boot access mongo:
public interface mongoreadrepository extends mongorepository<user, string> { @query(value = "{$where: 'this.name == ?0'}", count = true) public long countname(string name); }
and work, wonder know query accessing mongo
how that?
i try adding config @ properties below:
logging.level.org.springframework.data.mongodb.core.mongotemplate=debug logging.level.org.springframework.data.mongodb.repository.query=debug
and don't work.
could help?
i add line (below) in application.properties , works fine:
logging.level.org.springframework.data.mongodb.core.mongotemplate=debug
for query:
@query("{$and: [{'$or' : [{ 'name': {$regex : ?0, $options: 'i'}}, {'description': {$regex : ?1, $options: 'i'}}]}, { 'deleted' : ?2 }]}")
obtain log:
2016-09-27 10:53:26.245 debug 13604 --- [nio-9090-exec-3] o.s.data.mongodb.core.mongotemplate : find using query: { "$and" : [ { "$or" : [ { "name" : { "$regex" : "c" , "$options" : "i"}} , { "description" : { "$regex" : "c" , "$options" : "i"}}]} , { "deleted" : false}]} fields: null class: class com.habber.domain.entity in collection: entities
Comments
Post a Comment