apache / apache/grails-core

field mapping of a field of an embedded object is not taken into account if value of this field is unset

Open
#14,387 1 comment 3 reactions 0 assignees View on GitHub
relates-to: grails-data-mongodb
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

In org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec line 264 there's a code which should unset a field but the code use the property name of the entity instead of the field name of the mapping defined in GORM
![image](https://user-images.githubusercontent.com/7397383/95981852-9f0aeb00-0e1f-11eb-86de-b7b00241f448.png)

So the code should use prop.mappedForm.targetName instead of prop.name

The code is the same in the most recent version of the class so the issue is still here

Context :
Grails : 4.0.0
GORM : 7.0.0.RELEASE
Groovy : 2.5.6

Contributor guide

Open the contributing guide

Research direction

Start in org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec around line 264 and trace the unset path for fields in embedded objects. Verify that a field with a mapped target name is unset using that mapped name rather than the entity property name, and confirm the behavior with the relevant MongoDB persistence test coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, mongodb
Domain
database
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.