Skip to content

Commit 77c8ca9

Browse files
committed
RUST-397 Fix $readPreference not always being sent properly
1 parent 1e17849 commit 77c8ca9

File tree

1 file changed

+12
-1
lines changed
  • src/sdam/description/topology

1 file changed

+12
-1
lines changed

src/sdam/description/topology/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,18 @@ impl TopologyDescription {
188188

189189
command.read_pref = Some(resolved_read_pref);
190190
}
191-
_ => {}
191+
_ => {
192+
command.read_pref = match criteria {
193+
Some(SelectionCriteria::ReadPreference(rp)) => Some(rp.clone()),
194+
Some(SelectionCriteria::Predicate(_)) => {
195+
Some(ReadPreference::PrimaryPreferred {
196+
max_staleness: None,
197+
tag_sets: None,
198+
})
199+
}
200+
None => Some(ReadPreference::Primary),
201+
}
202+
}
192203
}
193204
}
194205

0 commit comments

Comments
 (0)