spring data - Extra quotes being added to @Query -


i have following json structure:

{   "communication": {       "office": {         "email": "test@example.com"       },       "private": {         "email": "test2@example.com"       },   } } 

i want query dynamically email based on type e.g. office or private. when use following command:

@query(value = "{ 'communication.?0.email' : ?1 }") object findbyemail(string type, string email); 

the

'communication.?0.email' 

is converted to

'communication."office".email' 

and mongo didn't find entry. how can avoid quotes before , after office?

simple answer spring mongo doesn't supports looking for. why not passing parameter rather below.

@query(value = "{ 'communication.?0.email' : ?1 }") object findbyemail(string type, string email);

where email value should

type= "communication." + type + ".email" 

Comments

Popular posts from this blog

java - Ebean enhancement ignores a model -

ubuntu - How to disable Kernel Module Signing in linux -

SQL php on different pages to Insert (mysqli) -