Skip to content

fix(mongodb): replace deprecated DecodeBytes - #1432

Merged
Fontinalis merged 1 commit into
masterfrom
fontinalis.mongodb-deprecated-decodebytes
Sep 7, 2026
Merged

fix(mongodb): replace deprecated DecodeBytes#1432
Fontinalis merged 1 commit into
masterfrom
fontinalis.mongodb-deprecated-decodebytes

Conversation

@Fontinalis

Copy link
Copy Markdown
Member

What changed

Replace the deprecated SingleResult.DecodeBytes call with SingleResult.Decode.

This keeps the MongoDB test compatible with both the current driver version and v1.17.7, where DecodeBytes causes a staticcheck failure. It unblocks #1429.

Testing

go test ./database/mongodb -run '^$'

Copilot AI lite review requested due to automatic review settings September 4, 2026 21:22
@Fontinalis Fontinalis added this to the v4.20.0 milestone Sep 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is a direct, equivalent replacement of a deprecated API with the supported decode path and appears consistent with the existing isMaster struct decoding logic.

Pull request overview

This PR updates the MongoDB replica-set initialization helper in the MongoDB test suite to avoid using the deprecated mongo.SingleResult.DecodeBytes, improving compatibility with newer mongo-driver versions (and removing a staticcheck failure in v1.17.7).

Changes:

  • Replace SingleResult.DecodeBytes + bson.Unmarshal with a single SingleResult.Decode(&status) call in waitForReplicaInit.
File summaries
File Description
database/mongodb/mongodb_test.go Simplifies RunCommand(...).Decode handling by decoding directly into the isMaster struct instead of decoding raw bytes and unmarshalling.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 54.412%. remained the same — fontinalis.mongodb-deprecated-decodebytes into master

@Fontinalis Fontinalis self-assigned this Sep 4, 2026
@Fontinalis
Fontinalis merged commit 3eac5d5 into master Sep 7, 2026
22 of 23 checks passed
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.

3 participants