mongo 1.8.6 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Rakefile +13 -1
  5. data/VERSION +1 -1
  6. data/bin/mongo_console +15 -0
  7. data/lib/mongo.rb +14 -0
  8. data/lib/mongo/collection.rb +80 -42
  9. data/lib/mongo/cursor.rb +15 -1
  10. data/lib/mongo/db.rb +56 -19
  11. data/lib/mongo/exceptions.rb +14 -0
  12. data/lib/mongo/gridfs/grid.rb +16 -3
  13. data/lib/mongo/gridfs/grid_ext.rb +14 -0
  14. data/lib/mongo/gridfs/grid_file_system.rb +16 -3
  15. data/lib/mongo/gridfs/grid_io.rb +17 -3
  16. data/lib/mongo/legacy.rb +14 -0
  17. data/lib/mongo/mongo_client.rb +93 -40
  18. data/lib/mongo/mongo_replica_set_client.rb +21 -0
  19. data/lib/mongo/mongo_sharded_client.rb +15 -1
  20. data/lib/mongo/networking.rb +14 -0
  21. data/lib/mongo/util/conversions.rb +16 -2
  22. data/lib/mongo/util/core_ext.rb +14 -31
  23. data/lib/mongo/util/logging.rb +23 -7
  24. data/lib/mongo/util/node.rb +17 -2
  25. data/lib/mongo/util/pool.rb +17 -1
  26. data/lib/mongo/util/pool_manager.rb +15 -2
  27. data/lib/mongo/util/read_preference.rb +14 -0
  28. data/lib/mongo/util/server_version.rb +15 -0
  29. data/lib/mongo/util/sharding_pool_manager.rb +13 -0
  30. data/lib/mongo/util/socket_util.rb +14 -0
  31. data/lib/mongo/util/ssl_socket.rb +48 -7
  32. data/lib/mongo/util/support.rb +14 -0
  33. data/lib/mongo/util/tcp_socket.rb +18 -4
  34. data/lib/mongo/util/thread_local_variable_manager.rb +14 -0
  35. data/lib/mongo/util/unix_socket.rb +20 -6
  36. data/lib/mongo/util/uri_parser.rb +16 -8
  37. data/lib/mongo/util/write_concern.rb +16 -2
  38. data/test/functional/authentication_test.rb +26 -1
  39. data/test/functional/collection_test.rb +140 -41
  40. data/test/functional/connection_test.rb +19 -6
  41. data/test/functional/conversions_test.rb +14 -0
  42. data/test/functional/cursor_fail_test.rb +14 -0
  43. data/test/functional/cursor_message_test.rb +14 -0
  44. data/test/functional/cursor_test.rb +15 -1
  45. data/test/functional/db_api_test.rb +15 -1
  46. data/test/functional/db_connection_test.rb +14 -0
  47. data/test/functional/db_test.rb +14 -0
  48. data/test/functional/grid_file_system_test.rb +16 -4
  49. data/test/functional/grid_io_test.rb +14 -0
  50. data/test/functional/grid_test.rb +14 -0
  51. data/test/functional/pool_test.rb +22 -6
  52. data/test/functional/safe_test.rb +14 -0
  53. data/test/functional/ssl_test.rb +109 -0
  54. data/test/functional/support_test.rb +14 -0
  55. data/test/functional/threading_test.rb +22 -8
  56. data/test/functional/timeout_test.rb +20 -6
  57. data/test/functional/uri_test.rb +14 -14
  58. data/test/functional/write_concern_test.rb +14 -0
  59. data/test/replica_set/authentication_test.rb +28 -2
  60. data/test/replica_set/basic_test.rb +14 -0
  61. data/test/replica_set/client_test.rb +14 -0
  62. data/test/replica_set/complex_connect_test.rb +14 -0
  63. data/test/replica_set/connection_test.rb +14 -0
  64. data/test/replica_set/count_test.rb +14 -0
  65. data/test/replica_set/cursor_test.rb +14 -0
  66. data/test/replica_set/insert_test.rb +14 -0
  67. data/test/replica_set/max_values_test.rb +14 -0
  68. data/test/replica_set/pinning_test.rb +14 -0
  69. data/test/replica_set/query_test.rb +14 -0
  70. data/test/replica_set/read_preference_test.rb +14 -0
  71. data/test/replica_set/refresh_test.rb +14 -0
  72. data/test/replica_set/replication_ack_test.rb +14 -0
  73. data/test/replica_set/ssl_test.rb +114 -0
  74. data/test/sharded_cluster/basic_test.rb +14 -0
  75. data/test/shared/authentication.rb +55 -0
  76. data/test/test_helper.rb +15 -1
  77. data/test/threading/basic_test.rb +14 -0
  78. data/test/tools/mongo_config.rb +16 -1
  79. data/test/tools/mongo_config_test.rb +15 -1
  80. data/test/unit/client_test.rb +14 -0
  81. data/test/unit/collection_test.rb +14 -0
  82. data/test/unit/connection_test.rb +14 -0
  83. data/test/unit/cursor_test.rb +14 -0
  84. data/test/unit/db_test.rb +15 -1
  85. data/test/unit/grid_test.rb +14 -0
  86. data/test/unit/mongo_sharded_client_test.rb +14 -0
  87. data/test/unit/node_test.rb +15 -0
  88. data/test/unit/pool_manager_test.rb +15 -0
  89. data/test/unit/pool_test.rb +14 -0
  90. data/test/unit/read_pref_test.rb +14 -0
  91. data/test/unit/read_test.rb +14 -0
  92. data/test/unit/safe_test.rb +14 -0
  93. data/test/unit/sharding_pool_manager_test.rb +15 -0
  94. data/test/unit/util_test.rb +14 -0
  95. data/test/unit/write_concern_test.rb +15 -1
  96. metadata +8 -4
  97. metadata.gz.sig +0 -0
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Mongo
2
16
  module GridExt
3
17
  module InstanceMethods
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Mongo
2
16
 
3
17
  # A file store built on the GridFS specification featuring
@@ -22,7 +36,6 @@ module Mongo
22
36
  @default_query_opts = {:sort => [['filename', 1], ['uploadDate', -1]], :limit => 1}
23
37
 
24
38
  # This will create indexes only if we're connected to a primary node.
25
- connection = @db.connection
26
39
  begin
27
40
  @files.ensure_index([['filename', 1], ['uploadDate', -1]])
28
41
  @chunks.ensure_index([['files_id', Mongo::ASCENDING], ['n', Mongo::ASCENDING]], :unique => true)
@@ -56,8 +69,8 @@ module Mongo
56
69
  # Notes on write concern:
57
70
  # When :w > 0, the chunks sent to the server
58
71
  # will be validated using an md5 hash. If validation fails, an exception will be raised.
59
- # @option opts [Integer] :versions (false) deletes all versions which exceed the number specified to
60
- # retain ordered by uploadDate. This option only works in 'w' mode. Certain precautions must be taken when
72
+ # @option opts [Integer] :versions (false) deletes all versions which exceed the number specified to
73
+ # retain ordered by uploadDate. This option only works in 'w' mode. Certain precautions must be taken when
61
74
  # deleting GridFS files. See the notes under GridFileSystem#delete.
62
75
  #
63
76
  # @example
@@ -1,12 +1,26 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'digest/md5'
2
16
 
3
17
  module Mongo
4
18
 
5
19
  # GridIO objects represent files in the GridFS specification. This class
6
20
  # manages the reading and writing of file chunks and metadata.
7
- class GridIO
21
+ class GridIO
8
22
  include Mongo::WriteConcern
9
-
23
+
10
24
  DEFAULT_CHUNK_SIZE = 256 * 1024
11
25
  DEFAULT_CONTENT_TYPE = 'binary/octet-stream'
12
26
  PROTECTED_ATTRS = [:files_id, :file_length, :client_md5, :server_md5]
@@ -238,7 +252,7 @@ module Mongo
238
252
  # @return [Mongo::GridIO] self
239
253
  def each
240
254
  return read_all unless block_given?
241
- while chunk = read(chunk_size)
255
+ while chunk = read(chunk_size)
242
256
  yield chunk
243
257
  break if chunk.empty?
244
258
  end
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Mongo
2
16
  module LegacyWriteConcern
3
17
  @legacy_write_concern = true
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'set'
2
16
  require 'socket'
3
17
  require 'thread'
@@ -16,8 +30,9 @@ module Mongo
16
30
  DEFAULT_HOST = 'localhost'
17
31
  DEFAULT_PORT = 27017
18
32
  DEFAULT_DB_NAME = 'test'
19
- GENERIC_OPTS = [:ssl, :auths, :logger, :connect]
33
+ GENERIC_OPTS = [:auths, :logger, :connect]
20
34
  TIMEOUT_OPTS = [:timeout, :op_timeout, :connect_timeout]
35
+ SSL_OPTS = [:ssl, :ssl_key, :ssl_cert, :ssl_verify, :ssl_ca_cert]
21
36
  POOL_OPTS = [:pool_size, :pool_timeout]
22
37
  READ_PREFERENCE_OPTS = [:read, :tag_sets, :secondary_acceptable_latency_ms]
23
38
  WRITE_CONCERN_OPTS = [:w, :j, :fsync, :wtimeout]
@@ -36,6 +51,7 @@ module Mongo
36
51
  :pool_timeout,
37
52
  :primary_pool,
38
53
  :socket_class,
54
+ :socket_opts,
39
55
  :op_timeout,
40
56
  :tag_sets,
41
57
  :acceptable_latency,
@@ -55,33 +71,43 @@ module Mongo
55
71
  # MongoClient#arbiters. This is useful if your application needs to connect manually to nodes other
56
72
  # than the primary.
57
73
  #
58
- # @param [String] host
59
- # @param [Integer] port specify a port number here if only one host is being specified.
60
- #
61
- # @option opts [String, Integer, Symbol] :w (1) Set default number of nodes to which a write
62
- # should be acknowledged
63
- # @option opts [Boolean] :j (false) Set journal acknowledgement
64
- # @option opts [Integer] :wtimeout (nil) Set replica set acknowledgement timeout
65
- # @option opts [Boolean] :fsync (false) Set fsync acknowledgement.
66
- #
67
- # Notes about write concern options:
68
- # Write concern options are propagated to objects instantiated from this MongoClient.
69
- # These defaults can be overridden upon instantiation of any object by explicitly setting an options hash
70
- # on initialization.
71
- # @option opts [Boolean] :slave_ok (false) Must be set to +true+ when connecting
72
- # to a single, slave node.
73
- # @option opts [Logger, #debug] :logger (nil) A Logger instance for debugging driver ops. Note that
74
- # logging negatively impacts performance; therefore, it should not be used for high-performance apps.
75
- # @option opts [Integer] :pool_size (1) The maximum number of socket self.connections allowed per
76
- # connection pool. Note: this setting is relevant only for multi-threaded applications.
77
- # @option opts [Float] :timeout (5.0) When all of the self.connections a pool are checked out,
78
- # this is the number of seconds to wait for a new connection to be released before throwing an exception.
79
- # Note: this setting is relevant only for multi-threaded applications (which in Ruby are rare).
80
- # @option opts [Float] :op_timeout (nil) The number of seconds to wait for a read operation to time out.
81
- # Disabled by default.
82
- # @option opts [Float] :connect_timeout (nil) The number of seconds to wait before timing out a
83
- # connection attempt.
84
- # @option opts [Boolean] :ssl (false) If true, create the connection to the server using SSL.
74
+ # @overload initialize(host, port, opts={})
75
+ # @param [String] host hostname for the target MongoDB server.
76
+ # @param [Integer] port specify a port number here if only one host is being specified.
77
+ # @param [Hash] opts hash of optional settings and configuration values.
78
+ #
79
+ # @option opts [String, Integer, Symbol] :w (1) Set default number of nodes to which a write
80
+ # should be acknowledged
81
+ # @option opts [Boolean] :j (false) Set journal acknowledgement
82
+ # @option opts [Integer] :wtimeout (nil) Set replica set acknowledgement timeout
83
+ # @option opts [Boolean] :fsync (false) Set fsync acknowledgement.
84
+ #
85
+ # Notes about Write-Concern Options:
86
+ # Write concern options are propagated to objects instantiated from this MongoClient.
87
+ # These defaults can be overridden upon instantiation of any object by explicitly setting an options hash
88
+ # on initialization.
89
+ #
90
+ # @option opts [Boolean] :ssl (false) If true, create the connection to the server using SSL.
91
+ # @option opts [String] :ssl_cert (nil) The certificate file used to identify the local connection against MongoDB.
92
+ # @option opts [String] :ssl_key (nil) The private keyfile used to identify the local connection against MongoDB.
93
+ # If included with the :ssl_cert then only :ssl_cert is needed.
94
+ # @option opts [Boolean] :ssl_verify (nil) Specifies whether or not peer certification validation should occur.
95
+ # @option opts [String] :ssl_ca_cert (nil) The ca_certs file contains a set of concatenated "certification authority"
96
+ # certificates, which are used to validate certificates passed from the other end of the connection.
97
+ # Required for :ssl_verify.
98
+ # @option opts [Boolean] :slave_ok (false) Must be set to +true+ when connecting
99
+ # to a single, slave node.
100
+ # @option opts [Logger, #debug] :logger (nil) A Logger instance for debugging driver ops. Note that
101
+ # logging negatively impacts performance; therefore, it should not be used for high-performance apps.
102
+ # @option opts [Integer] :pool_size (1) The maximum number of socket self.connections allowed per
103
+ # connection pool. Note: this setting is relevant only for multi-threaded applications.
104
+ # @option opts [Float] :timeout (5.0) When all of the self.connections a pool are checked out,
105
+ # this is the number of seconds to wait for a new connection to be released before throwing an exception.
106
+ # Note: this setting is relevant only for multi-threaded applications.
107
+ # @option opts [Float] :op_timeout (nil) The number of seconds to wait for a read operation to time out.
108
+ # Disabled by default.
109
+ # @option opts [Float] :connect_timeout (nil) The number of seconds to wait before timing out a
110
+ # connection attempt.
85
111
  #
86
112
  # @example localhost, 27017 (or <code>ENV["MONGODB_URI"]</code> if available)
87
113
  # MongoClient.new
@@ -122,6 +148,9 @@ module Mongo
122
148
  @tag_sets = []
123
149
  @acceptable_latency = 15
124
150
 
151
+ @max_message_size = nil
152
+ @max_bson_size = nil
153
+
125
154
  check_opts(opts)
126
155
  setup(opts.dup)
127
156
  end
@@ -242,7 +271,7 @@ module Mongo
242
271
  return false if @auths.empty?
243
272
  @auths.each do |auth|
244
273
  self[auth[:db_name]].issue_authentication(auth[:username], auth[:password], false,
245
- :socket => opts[:socket])
274
+ :source => auth[:source], :socket => opts[:socket])
246
275
  end
247
276
  true
248
277
  end
@@ -260,7 +289,7 @@ module Mongo
260
289
  # @param [String] password
261
290
  #
262
291
  # @return [Hash] a hash representing the authentication just added.
263
- def add_auth(db_name, username, password)
292
+ def add_auth(db_name, username, password, source)
264
293
  if @auths.any? {|a| a[:db_name] == db_name}
265
294
  raise MongoArgumentError, "Cannot apply multiple authentications to database '#{db_name}'"
266
295
  end
@@ -268,7 +297,8 @@ module Mongo
268
297
  auth = {
269
298
  :db_name => db_name,
270
299
  :username => username,
271
- :password => password
300
+ :password => password,
301
+ :source => source
272
302
  }
273
303
  @auths << auth
274
304
  auth
@@ -306,8 +336,9 @@ module Mongo
306
336
  # @return [Hash]
307
337
  def database_info
308
338
  doc = self['admin'].command({:listDatabases => 1})
309
- doc['databases'].each_with_object({}) do |db, info|
339
+ doc['databases'].inject({}) do |info, db|
310
340
  info[db['name']] = db['sizeOnDisk'].to_i
341
+ info
311
342
  end
312
343
  end
313
344
 
@@ -440,9 +471,7 @@ module Mongo
440
471
  # @raise [ConnectionFailure] if unable to connect to any host or port.
441
472
  def connect
442
473
  close
443
-
444
474
  config = check_is_master(host_port)
445
-
446
475
  if config
447
476
  if config['ismaster'] == 1 || config['ismaster'] == true
448
477
  @read_primary = true
@@ -462,6 +491,7 @@ module Mongo
462
491
  if !connected?
463
492
  raise ConnectionFailure, "Failed to connect to a master node at #{host_port.join(":")}"
464
493
  end
494
+ true
465
495
  end
466
496
  alias :reconnect :connect
467
497
 
@@ -555,7 +585,7 @@ module Mongo
555
585
  begin
556
586
  host, port = *node
557
587
  config = nil
558
- socket = @socket_class.new(host, port, @op_timeout, @connect_timeout)
588
+ socket = @socket_class.new(host, port, @op_timeout, @connect_timeout, @socket_opts)
559
589
  if @connect_timeout
560
590
  Timeout::timeout(@connect_timeout, OperationTimeout) do
561
591
  config = self['admin'].command({:ismaster => 1}, :socket => socket)
@@ -579,7 +609,8 @@ module Mongo
579
609
  POOL_OPTS +
580
610
  READ_PREFERENCE_OPTS +
581
611
  WRITE_CONCERN_OPTS +
582
- TIMEOUT_OPTS
612
+ TIMEOUT_OPTS +
613
+ SSL_OPTS
583
614
  end
584
615
 
585
616
  def check_opts(opts)
@@ -593,11 +624,32 @@ module Mongo
593
624
  # Parse option hash
594
625
  def setup(opts)
595
626
  @slave_ok = opts.delete(:slave_ok)
627
+ @ssl = opts.delete(:ssl)
628
+ @unix = @host ? @host.end_with?('.sock') : false
629
+
630
+ # if ssl options are present, but ssl is nil/false raise for misconfig
631
+ ssl_opts = opts.keys.select { |k| k.to_s.start_with?('ssl') }
632
+ if ssl_opts.size > 0 && !@ssl
633
+ raise MongoArgumentError, "SSL has not been enabled (:ssl=false) " +
634
+ "but the following SSL related options were " +
635
+ "specified: #{ssl_opts.join(', ')}"
636
+ end
596
637
 
597
- @ssl = opts.delete(:ssl)
598
- @unix = @host ? @host.end_with?('.sock') : false
599
-
638
+ @socket_opts = {}
600
639
  if @ssl
640
+ # construct ssl socket opts
641
+ @socket_opts[:key] = opts.delete(:ssl_key)
642
+ @socket_opts[:cert] = opts.delete(:ssl_cert)
643
+ @socket_opts[:verify] = opts.delete(:ssl_verify)
644
+ @socket_opts[:ca_cert] = opts.delete(:ssl_ca_cert)
645
+
646
+ # verify peer requires ca_cert, raise if only one is present
647
+ if @socket_opts[:verify] && !@socket_opts[:ca_cert]
648
+ raise MongoArgumentError,
649
+ "If :ssl_verify_mode has been specified, then you must include " +
650
+ ":ssl_ca_cert in order to perform server validation."
651
+ end
652
+
601
653
  @socket_class = Mongo::SSLSocket
602
654
  elsif @unix
603
655
  @socket_class = Mongo::UNIXSocket
@@ -612,7 +664,8 @@ module Mongo
612
664
  @pool_size = opts.delete(:pool_size) || 1
613
665
  if opts[:timeout]
614
666
  warn "The :timeout option has been deprecated " +
615
- "and will be removed in the 2.0 release. Use :pool_timeout instead."
667
+ "and will be removed in the 2.0 release. " +
668
+ "Use :pool_timeout instead."
616
669
  end
617
670
  @pool_timeout = opts.delete(:pool_timeout) || opts.delete(:timeout) || 5.0
618
671
 
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Mongo
2
16
 
3
17
  # Instantiates and manages connections to a MongoDB replica set.
@@ -69,6 +83,13 @@ module Mongo
69
83
  # @option opts [Float] :connect_timeout (30) The number of seconds to wait before timing out a
70
84
  # connection attempt.
71
85
  # @option opts [Boolean] :ssl (false) If true, create the connection to the server using SSL.
86
+ # @option opts [String] :ssl_cert (nil) The certificate file used to identify the local connection against MongoDB.
87
+ # @option opts [String] :ssl_key (nil) The private keyfile used to identify the local connection against MongoDB.
88
+ # If included with the :ssl_cert then only :ssl_cert is needed.
89
+ # @option opts [Boolean] :ssl_verify (nil) Specifies whether or not peer certification validation should occur.
90
+ # @option opts [String] :ssl_ca_cert (nil) The ca_certs file contains a set of concatenated "certification authority"
91
+ # certificates, which are used to validate certificates passed from the other end of the connection.
92
+ # Required for :ssl_verify.
72
93
  # @option opts [Boolean] :refresh_mode (false) Set this to :sync to periodically update the
73
94
  # state of the connection every :refresh_interval seconds. Replica set connection failures
74
95
  # will always trigger a complete refresh. This option is useful when you want to add new nodes
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Mongo
2
16
 
3
17
  # Instantiates and manages connections to a MongoDB sharded cluster for high availability.
@@ -52,7 +66,7 @@ module Mongo
52
66
  end
53
67
 
54
68
  def valid_opts
55
- GENERIC_OPTS + SHARDED_CLUSTER_OPTS + READ_PREFERENCE_OPTS + WRITE_CONCERN_OPTS
69
+ super + SHARDED_CLUSTER_OPTS
56
70
  end
57
71
 
58
72
  def inspect
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Mongo
2
16
  module Networking
3
17
 
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2013 10gen Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Mongo #:nodoc:
2
16
 
3
17
  # Utility module to include when needing to convert certain types of
@@ -31,7 +45,7 @@ module Mongo #:nodoc:
31
45
  end
32
46
 
33
47
  # Converts the supplied +Array+ to a +Hash+ to pass to mongo as
34
- # sorting parameters. The returned +Hash+ will vary depending
48
+ # sorting parameters. The returned +Hash+ will vary depending
35
49
  # on whether the passed +Array+ is one or two dimensional.
36
50
  #
37
51
  # Example:
@@ -73,7 +87,7 @@ module Mongo #:nodoc:
73
87
  { str => 1 }
74
88
  end
75
89
 
76
- # Converts the +String+, +Symbol+, or +Integer+ to the
90
+ # Converts the +String+, +Symbol+, or +Integer+ to the
77
91
  # corresponding sort value in MongoDB.
78
92
  #
79
93
  # Valid conversions (case-insensitive):