Closed zraul123 closed 9 months ago
Yes, you are right. This is a bug. I will fix it. Thank you for reporting!
The read-preferences should only used for read operations. Creating an index is not a read operation, so I will check, why the read-preferences is sent to the MongoDB in this case.
It is fixed. Feel free to test it and maybe reopen/create a new issue!
We've been using the mongodb-driver with the following option at start_link
In 1.2.1 this was changed, and I tried:
%{mode: :primary_preferred}
directly -> fails at commands such asaddIndex
since it expects:primaryPreferred
Mongo.ReadPreference.to_replica_set(%{mode: :primary_preferred})
which basically translates it to%{mode: :primaryPreferred}
. This works for single-instances, sharded instances - but when the topology isreplica_set_with_primary
it fails atMongo.TopologyDescription.select_replica_set_server
since it can't pattern match. The expected atom is:primary_preferred
(line 200 in topology_description.ex), and it's called with:primaryPreferred
.I can't seem to create a test-case to reproduce this exact issue, have you considered adding some integration tests with docker on this repo? I can help if so. Thanks!