codeconsole commented on PR #16297:
URL: https://github.com/apache/grails-core/pull/16297#issuecomment-5544379653
Took the other option: the non-codec engine is fixed rather than excluded,
so the default applies to both. Three isolated commits, and the engine scoping
from `41b9230` is removed.
**`3a99093` — `_id` storage and lookup.** Four places, not the one I fixed
last round. `storeEntry` overwrites `_id` with the declared-type identifier
immediately after `generateIdentifier` runs, which is why fixing the latter
alone had no effect. `createDBObjectWithKey` builds the by-key filter.
`MongoSession` builds the flush-time update filter and the single and batch
delete keys. Its iterable delete filters on the literal `_id` field rather than
the logical identity name, exactly as you noted, so the criterion preprocessing
never sees it.
**`60c3671` — association references.** `formulateDatabaseReference` and
`setEmbeddedCollectionKeys` now coerce through the target entity's id mapping,
covering plain foreign keys, DBRef `$id` values and embedded collection
references.
**`ce89107` — `updateAll` plus removing the scoping.** The bulk path now
extracts the identifier, coerces it, and emits a DBRef where the mapping asks
for one, normalised into a copy of the caller's map.
`MappingEngineStringIdStorageSpec` covers this engine end to end: insert,
point read, update, single delete, iterable delete, to-one reference storage,
traversal, and bulk association update. Each case was checked against reverted
production code so it fails without its fix.
Two things that made the coverage harder than it looks, worth recording
since they cost me two false green runs:
- GORM statics bind to whichever datastore registered the class last, which
is the codec one in this spec. My first `updateAll` case used `MeAsset.where {
}.updateAll(..)` and passed with the fix reverted, because it never touched
this engine. It now calls `MongoSession.updateAll` with a `DetachedCriteria`
directly.
- The spec asserts up front that the session really is a `MongoSession`.
Without that guard the whole file would pass against the codec engine and prove
nothing.
`grails-data-mongodb-core` is at parity with `8.0.x` locally - the two
`MongoDatastoreLifecycleSpec` failures reproduce on an unmodified checkout
here. checkstyle and codenarc clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]