Skip to content

Keep mongo full document as bson.Raw#369

Merged
adiom-mark merged 1 commit intomainfrom
mongodecode
Feb 13, 2026
Merged

Keep mongo full document as bson.Raw#369
adiom-mark merged 1 commit intomainfrom
mongodecode

Conversation

@adiom-mark
Copy link
Collaborator

@adiom-mark adiom-mark commented Feb 12, 2026

Summary by CodeRabbit

  • Breaking Changes
    • Change stream payload format updated: insert/update events now deliver the full document in a raw payload format rather than as a mapped object. Consumer code that reads change events must be updated to handle the new payload format and parsing (this may require code adjustments where change-event data was previously accessed).

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

The MongoDB connector's change-stream handling was updated: full documents are no longer marshaled to bson.Raw for insert/update paths; instead change event FullDocument is assigned directly as raw BSON. MongoUpdate.FullDocument type changed from bson.M to bson.Raw.

Changes

Cohort / File(s) Summary
MongoDB Change Stream Handling
connectors/mongo/conn.go
Changed MongoUpdate.FullDocument from bson.M to bson.Raw. For insert/update events, Update.Data now receives change.FullDocument directly; removed intermediate marshaling and replaced nil checks with length-based emptiness checks/early returns.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 I nibble bytes where maps once lay,
Raw BSON hopping straight this way,
No marshal detours to slow the stream,
Direct and tidy — a coder's dream! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Keep mongo full document as bson.Raw' directly and specifically describes the main change: modifying how MongoDB full documents are handled by keeping them as bson.Raw instead of marshaling to bson.M.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mongodecode

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@connectors/mongo/conn.go`:
- Around line 644-654: The nil-check for change.FullDocument in the
"update"/"replace" branch is insufficient because FullDocument is a bson.Raw
(not a Go nil when Mongo returns BSON null); update the condition in the case
handling (where adiomv1.Update is constructed) to detect empty or BSON null
payloads by using len(change.FullDocument) == 0 or inspecting
change.FullDocument.Type/Lookup(), and return nil,nil when empty/null; apply the
same validation to the insert handling to ensure no null/empty bson.Raw is sent
as adiomv1.Update.Data.

@adiom-mark adiom-mark merged commit 5436945 into main Feb 13, 2026
2 checks passed
@adiom-mark adiom-mark deleted the mongodecode branch February 13, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant