Konstantin Petrukhnov opened DATAMONGO-1050 and commented
SimpleMongoRepository.findById(id, class) don't return ids for nested documents.
E.g.
class A {
private String id; //stored in mongo as "id"
private String name;
}
class B {
private String id; // stored in mongo as "_id"
private List<A> innerDocs;
}
When it return B documents, innerDocs A objects have id == null. If i refactor A.id to A.myId, then it start working correctly.
Saving data (save, updateFirst, etc) always save fields correctly.
A and B objects are pojos (only lombok @Data and @NoArgsConstructor is used to provide getters and setters). Ids are created by mongo.
Could it related somehow to ids that have 24 characters, but stored not as "_id"?
Easy workaround is to have different field name (not "id").
Affects: 1.5.1 (Dijkstra SR1), 1.6 GA (Evans)
Referenced from: pull request #225