MongoDB C#驱动程序发送到副本集成员的未指定端点
例如,我有3个mongodb replicaset节点 主要:MongoDB C#驱动程序发送到副本集成员的未指定端点,c#,mongodb,connection-string,mongodb-.net-driver,C#,Mongodb,Connection String,Mongodb .net Driver,例如,我有3个mongodb replicaset节点 主要:localhost:27017,次要:localhost:27018和localhost:27019。 我传递给mongodb驱动程序连接字符串mongodb://localhost:27019,localhost:27017/admin?readPreference=secondaryPreferred 但当我跟踪请求时,我发现mongodb驱动程序将部分请求发送到连接字符串中未指定的节点localhost:27018。 如何防止向
localhost:27017
,次要:localhost:27018
和localhost:27019
。
我传递给mongodb驱动程序连接字符串mongodb://localhost:27019,localhost:27017/admin?readPreference=secondaryPreferred
但当我跟踪请求时,我发现mongodb驱动程序将部分请求发送到连接字符串中未指定的节点localhost:27018
。
如何防止向未指定的节点发送请求?尝试使用
directConnection=true
连接字符串选项使用directConnection=true
连接字符串选项