Skip to content

Commit

Permalink
Fix replicaset parsing for older clients
Browse files Browse the repository at this point in the history
Older drivers do not support `helloOk` and have `topologyVersion` instead of `hosts` in MongoDB messages starting from 4.4.
  • Loading branch information
alekseiplotnikov authored and mpihlak committed Dec 19, 2023
1 parent cb3dd41 commit 81a49e9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proxy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mongoproxy"
version = "0.5.29"
version = "0.5.30"
authors = ["mpihlak <martin.pihlak@starship.co>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion proxy/src/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ impl MongoStatsTracker{

fn try_parsing_replicaset(&mut self, doc: &Document) {
if let Some(op) = doc.get_str("op") {
if (op == "hosts") || (op == "helloOk") {
if (op == "hosts") || (op == "helloOk") || (op == "topologyVersion") {
if let Some(replicaset) = doc.get_str("replicaset") {
self.replicaset = replicaset.to_owned();
}
Expand Down

0 comments on commit 81a49e9

Please sign in to comment.