Does Spring Data treats mongo nested "id" attributes differently? I explain the problem I have collection matches with the following structure
"teams": [
{
"id" : "5601",
"name" : "FC Basel"
},
... // more
]
When I want to retrieve all the matches which has team id 5601 I execute the following query
db.matches.find({ "teams.id" : "5601"})
Which works perfectly and returns some objects.
When I make a method
public List<MatchMongo> findByTeams_id(String id);
on my MatchRepository implementation I get 0 results back while there are. Logs shows
Created query Query: { "teams.id" : "5601"}, Fields: null, Sort: null
find using query: { "teams.id" : "5601"} fields: null for class: class
MatchMongo in collection: matches
So the query he makes seems to be the right one... :S Trying with other fields (referee.name for ex.) works.
I even tried with the @Query annotation, but can't get it to work
Is there another solution? Is this a bug or am I doing something wrong?
Aucun commentaire:
Enregistrer un commentaire