Skip to content

@Query annotated repository query fails to map complex Id structure. [DATAMONGO-1078] #1998

Closed
@spring-projects-issues

Description

@spring-projects-issues

Christoph Strobl opened DATAMONGO-1078 and commented

StringBasedMongoQuery converts any complex object to the according mongo type including type restrictions via _class. Therefore annotated queries like:

@Query("{'_id': {$in: ?0}}")
List<User> findByUserIds(Collection<MyUserId> userIds);

end up being converted to:

{_id:  {$in: [ {_class:"com.sampleuser.MyUserId", userId:"....", sampleId:"...."}, ...

So we need to check for the presence of typeKey when converting id properties


Affects: 1.5.4 (Dijkstra SR4), 1.6 GA (Evans)

Reference URL: http://stackoverflow.com/questions/26596007/spring-mongorepository-query-adding-class-field-to-queries

Issue Links:

  • DATAMONGO-1088 @Query $in does not remove "class" property on collection of embedded objects
    (
    "is duplicated by"_)

Referenced from: pull request #239

Backported to: 1.6.2 (Evans SR2), 1.5.5 (Dijkstra SR5)

Metadata

Metadata

Labels

in: mappingMapping and conversion infrastructuretype: bugA general bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions