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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +4 -1
- data/lib/mongo/client.rb +1 -1
- data/lib/mongo/collection.rb +1 -1
- data/lib/mongo/database.rb +31 -0
- data/lib/mongo/version.rb +1 -1
- data/spec/integration/retryable_writes_spec.rb +17 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b77d2eec3799354ea1153bac8ce5e4cee16cbab93774e9f877ee441f34aabe47
|
4
|
+
data.tar.gz: 1f9c0ae6afcd403a90cebd1e31d1cc3cd4fb36a927ae6bbcaa1d089868755eb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d06d245155dc239304713f24513285ca47c927a222e95d77a36065180ce6e8456510360ddf404bf628f8f59053a188331292b56896552cf29c8437454e8f158a
|
7
|
+
data.tar.gz: 16cfd26917aa33baa71db76308a2c39e0f67c96dfd8981719d3f31c8dda815bdf2c569a5ff17e5bc2a45fdd7349182862adb838137e8e6046246e79f4237ace7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
|
1
|
+
{�_i߳���#�Ԃq�t�:鬻ǭ �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
|
data/lib/mongo/client.rb
CHANGED
@@ -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).
|
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.
|
data/lib/mongo/collection.rb
CHANGED
@@ -166,7 +166,7 @@ module Mongo
|
|
166
166
|
#
|
167
167
|
# @since 2.0.0
|
168
168
|
def capped?
|
169
|
-
database.
|
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.
|
data/lib/mongo/database.rb
CHANGED
@@ -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
|
data/lib/mongo/version.rb
CHANGED
@@ -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.
|
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-
|
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
|