Skip to content

Commit 91eae0c

Browse files
committed
read-preference only for read commands
1 parent 5faeefc commit 91eae0c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ env:
2626
- MONGODB=3.2.20
2727
- MONGODB=3.4.16
2828
- MONGODB=3.6.6
29-
- MONGODB=4.0.9
29+
- MONGODB=4.2

lib/mongo.ex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,10 @@ defmodule Mongo do
306306
"""
307307
def issue_command(topology_pid, cmd, type, opts) do
308308

309-
new_cmd = ReadPreference.add_read_preference(cmd, opts)
309+
new_cmd = case type do
310+
:read -> ReadPreference.add_read_preference(cmd, opts)
311+
:write -> cmd
312+
end
310313

311314
Logger.debug("issue_command: #{inspect type} #{inspect new_cmd}")
312315

0 commit comments

Comments
 (0)