File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,16 @@ func TestGridFS(t *testing.T) {
35
35
}
36
36
},
37
37
}
38
- clientOpts := options .Client ().ApplyURI (cs .Original ).SetReadPreference (readpref .Primary ()).
39
- SetWriteConcern (writeconcern .New (writeconcern .WMajority ())).SetPoolMonitor (poolMonitor )
38
+ clientOpts := options .Client ().
39
+ ApplyURI (cs .Original ).
40
+ SetReadPreference (readpref .Primary ()).
41
+ SetWriteConcern (writeconcern .New (writeconcern .WMajority ())).
42
+ SetPoolMonitor (poolMonitor ).
43
+ // Connect to a single host. For sharded clusters, this will pin to a single mongos, which avoids
44
+ // non-deterministic versioning errors in the server. This has no effect for replica sets because the driver
45
+ // will discover the other hosts during SDAM checks.
46
+ SetHosts (cs .Hosts [:1 ])
47
+
40
48
client , err := mongo .Connect (context .Background (), clientOpts )
41
49
assert .Nil (t , err , "Connect error: %v" , err )
42
50
db := client .Database ("gridfs" )
You can’t perform that action at this time.
0 commit comments