mongo 2.9.1 → 2.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1021b405443096b923a6d84d00500e95303517d8dff0d71bb48ecd6c2c7d25a5
4
- data.tar.gz: feb30475f0b4ab34599d2cee2cc68fc6d8aa129c69519770140a323696c8c3b6
3
+ metadata.gz: b77d2eec3799354ea1153bac8ce5e4cee16cbab93774e9f877ee441f34aabe47
4
+ data.tar.gz: 1f9c0ae6afcd403a90cebd1e31d1cc3cd4fb36a927ae6bbcaa1d089868755eb5
5
5
  SHA512:
6
- metadata.gz: 859cb4a6d243af0e3cfbb73db9b430d74430327ef9b12471eff91cc8d04588379a6f22ba29ae441c2fcff57e4431196319a82795d4ef752d4c6e9fdfae623dd6
7
- data.tar.gz: 256a9aed9e7460d025dee8df1b5890cd2dc4461577c4221dc3c93bf7f656869b7877a92f7e931d6edbd3cda1c217b51022e3ebb132d03be4b289f06d75924141
6
+ metadata.gz: d06d245155dc239304713f24513285ca47c927a222e95d77a36065180ce6e8456510360ddf404bf628f8f59053a188331292b56896552cf29c8437454e8f158a
7
+ data.tar.gz: 16cfd26917aa33baa71db76308a2c39e0f67c96dfd8981719d3f31c8dda815bdf2c569a5ff17e5bc2a45fdd7349182862adb838137e8e6046246e79f4237ace7
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,4 @@
1
- EfDQ�Pas��3��\�3�h"ױsKg�4p���^ �"TВ�7�Z��4��!�k�s�~�������φ����jj�)�,���@��$ӗ��n��j�j��߄����֧l/ח
1
+ {_i߳���#�Ԃqt�:鬻ǭ z���'t�Ġ�H
2
+ �?4Ft�5�>;��pu3%o/י$�n��W[�VP[��m�y*p<��8�KD0�3��.N����&A.:�EJ�.wM�6������"��
3
+ U�`�W*O��܁��ǟ���j��.k� -;;o������]�S�s�b�����x��Vx������ �
4
+ `�� �A�3bagRbzb=�X�!ڃ�jHo8�1�or�M6R��w�����7
@@ -633,7 +633,7 @@ module Mongo
633
633
  cmd = { listDatabases: 1 }
634
634
  cmd[:nameOnly] = !!name_only
635
635
  cmd[:filter] = filter unless filter.empty?
636
- use(Database::ADMIN).command(cmd, opts).first[Database::DATABASES]
636
+ use(Database::ADMIN).database.read_command(cmd, opts).first[Database::DATABASES]
637
637
  end
638
638
 
639
639
  # Returns a list of Mongo::Database objects.
@@ -166,7 +166,7 @@ module Mongo
166
166
  #
167
167
  # @since 2.0.0
168
168
  def capped?
169
- database.command(:collstats => name).documents[0][CAPPED]
169
+ database.read_command(:collstats => name).documents[0][CAPPED]
170
170
  end
171
171
 
172
172
  # Force the collection to be created in the database.
@@ -156,6 +156,37 @@ module Mongo
156
156
  #
157
157
  # @return [ Hash ] The result of the command execution.
158
158
  def command(operation, opts = {})
159
+ txn_read_pref = if opts[:session] && opts[:session].in_transaction?
160
+ opts[:session].txn_read_preference
161
+ else
162
+ nil
163
+ end
164
+ txn_read_pref ||= opts[:read] || ServerSelector::PRIMARY
165
+ Lint.validate_underscore_read_preference(txn_read_pref)
166
+ selector = ServerSelector.get(txn_read_pref)
167
+
168
+ client.send(:with_session, opts) do |session|
169
+ server = selector.select_server(cluster)
170
+ Operation::Command.new({
171
+ :selector => operation.dup,
172
+ :db_name => name,
173
+ :read => selector,
174
+ :session => session
175
+ }).execute(server)
176
+ end
177
+ end
178
+
179
+ # Execute a read command on the database, retrying the read if necessary.
180
+ #
181
+ # @param [ Hash ] operation The command to execute.
182
+ # @param [ Hash ] opts The command options.
183
+ #
184
+ # @option opts :read [ Hash ] The read preference for this command.
185
+ # @option opts :session [ Session ] The session to use for this command.
186
+ #
187
+ # @return [ Hash ] The result of the command execution.
188
+ # @api private
189
+ def read_command(operation, opts = {})
159
190
  txn_read_pref = if opts[:session] && opts[:session].in_transaction?
160
191
  opts[:session].txn_read_preference
161
192
  else
@@ -17,5 +17,5 @@ module Mongo
17
17
  # The current version of the driver.
18
18
  #
19
19
  # @since 2.0.0
20
- VERSION = '2.9.1'.freeze
20
+ VERSION = '2.9.2'.freeze
21
21
  end
@@ -688,4 +688,21 @@ describe 'Retryable writes integration tests' do
688
688
 
689
689
  it_behaves_like 'an operation that does not support retryable writes'
690
690
  end
691
+
692
+ context 'when the operation is database#command' do
693
+
694
+ let(:operation) do
695
+ collection.database.command(ping: 1)
696
+ end
697
+
698
+ let(:expectation) do
699
+ 0
700
+ end
701
+
702
+ let(:unsuccessful_retry_value) do
703
+ 0
704
+ end
705
+
706
+ it_behaves_like 'an operation that does not support retryable writes'
707
+ end
691
708
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -31,7 +31,7 @@ cert_chain:
31
31
  bMYVwXXhV8czdzgkQB/ZPWHSbEWXnmkze1mzvqWBCPOVXYrcnL9cnEl/RoxtS1hr
32
32
  Db6Ac6mCUSYfYHBWpWqxjc45n70i5Xi1
33
33
  -----END CERTIFICATE-----
34
- date: 2019-08-13 00:00:00.000000000 Z
34
+ date: 2019-09-23 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bson
metadata.gz.sig CHANGED
Binary file