Skip to content

Type hint not added when updating nested list elements with inheritance [DATAMONGO-1772] #2678

Closed
@spring-projects-issues

Description

@spring-projects-issues

Etienne Dethoor opened DATAMONGO-1772 and commented

Hello,

I encounter a strange bug when I use inheritance with SpringData MongoDB.

When i use the save() method of a SpringData MongoDB repository, everything is going well.

But if i use a custom update query with MongoTemplate (updateFirst()), the _class key is not added and persisted in MongoDB for a Class who inherit another abstract Class.

I've pushed a small project who demonstrate the bug : https://github.com/edethoor/bugStringData

I wrote two tests :

  • usage of classic save method -> OK
  • usage of custom update -> KO

I think the problem appears when using the removeTypeInfo() method of the MappingMongoConverter class because the _class is added during the object convertion but removed when this line is executed.

Could you see what happens please ?
Thanks,
Etienne


Affects: 1.10.6 (Ingalls SR6)

Referenced from: pull request #497, and commits 7cf69c5, 022d55d, 1663048, 4944428, fa9074b

Backported to: 1.10.7 (Ingalls SR7)

Metadata

Metadata

Labels

in: mappingMapping and conversion infrastructuretype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions