mattcasters opened a new pull request, #7495:
URL: https://github.com/apache/hop/pull/7495
## What changed
- Parse incoming JSON field values through a temporary wrapper document in
`MongoDbOutputData.setMongoValueFromHopValue()` before assigning them into
MongoDB documents.
- Add unit test `testGetQueryObjectWithIncomingObjectIdJson` for extended
JSON `{"$oid":"..."}` as an `_id` update match field.
- Add `integration-tests/mongo/tests/mongo-objectid-update/` suite:
- insert docs with fixed ObjectId `_id`s
- update matching on `_id` with `json_field=Y`
- validate both documents receive `status=new`
- workflows for `mongo` and `mongo-atlas` connections
## Why
After the BSON 5.x upgrade, top-level extended JSON ObjectId values fail in
`Document.parse()` with `BsonInvalidOperationException` (`OBJECT_ID` vs
expected `DOCUMENT`). That breaks MongoDB Output when using `_id` (or any
ObjectId field) as an update match field with `json_field=Y`.
Wrapping the value lets the codec decode the scalar and keeps a real BSON
`ObjectId`, so updates match correctly again.
Fixes #7183.
## Validation
- `./mvnw -pl plugins/tech/mongodb -Dtest=MongoDbOutputDataTest test`
- `./mvnw -pl plugins/tech/mongodb test`
- Client assembly rebuilt, then:
- `integration-tests/scripts/run-tests-docker.sh PROJECT_NAME=mongo` —
**passed** (includes new `mongo-objectid-update` suite)
--
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]