-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.0.4
-
Component/s: Sharded Cluster
-
None
-
Environment:CentOS 6.4
Ruby 2.1.2
Specifies following options in "Mongo::Client".
- Connects to a mongos server. and
- Not specifies ":connect => :sharded". and
- Specifies "primary_preferred" to a read preference.
Rerieves documents by using "find" method.
But "find" method runs well if following options are specified in "Mongo::Client".
- Specifies ":connect => :sharded". or
- Specifies "primary" to a read preference.
Ruby Code
=========
require 'mongo'
db = Mongo::Client.new(
['test-server:20001'],
{
:database => "test",
:user => "test_user",
:password => "test_pass",
- :connect => :sharded, # find method runs well when ":connect => :sharded" is specified.
:read => { :mode => :primary_preferred } # find method runs well when ":primary" is specified.
}
)
cur = db["test"].find()
col = nil; cur.each { |c| col = c; break }puts( col )
Result
======