apache / apache/grails-core

NativeEntry object format incorrect in Grails 3.1.16

Open
#14,542 0 comments 0 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

I am converting Grails from 3.0 to 3.1, here, in 3.1 nativeEntry is returning as a domain class while in previous version, nativeEntry is returning as BasicDBObject. Also embedded document format is not same in both version. May be I am not using it in a correct way or there is any bug?
Grails 3.1 is using MongoCodecSession and the problem is arising in this, But when I have converted MongoCodecSession to MongoSession, then afterwards when I am saving my instance's empty list field in mongodb was null. I am preferring MongoCodecSession. Any suggestions?
```
def update_val
class_object.class.withNewSession { MongoCodecSession m ->
update_val = m.pendingUpdates.find {
it.key.name == d.class.getName()
}.value[0]nativeEntry.regions[0]."${instance.getDbKey()}"[0]
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Grails 3.0-to-3.1 behavior using the shown withNewSession and pendingUpdates code, then inspect MongoCodecSession and the nativeEntry value. Compare the domain-class versus BasicDBObject and embedded-document formats, including how empty list fields are saved; done means the expected format and persistence behavior are consistent or the discrepancy is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, mongodb
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.