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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -