mongo 2.16.1 → 2.16.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/lib/mongo/collection/view/builder/map_reduce.rb +7 -4
- data/lib/mongo/collection/view/map_reduce.rb +14 -1
- data/lib/mongo/version.rb +1 -1
- data/spec/lite_spec_helper.rb +7 -0
- data/spec/mongo/collection/view/map_reduce_spec.rb +16 -0
- data/spec/runners/auth.rb +1 -1
- data/spec/runners/change_streams/spec.rb +1 -1
- data/spec/runners/cmap.rb +1 -1
- data/spec/runners/command_monitoring.rb +1 -1
- data/spec/runners/connection_string.rb +1 -1
- data/spec/runners/crud/spec.rb +1 -3
- data/spec/runners/gridfs.rb +1 -1
- data/spec/runners/read_write_concern_document.rb +1 -1
- data/spec/runners/sdam.rb +1 -1
- data/spec/runners/server_selection.rb +1 -1
- data/spec/runners/server_selection_rtt.rb +1 -1
- data/spec/runners/unified/test_group.rb +1 -1
- data/spec/spec_tests/seed_list_discovery_spec.rb +1 -1
- data/spec/support/utils.rb +31 -0
- data.tar.gz.sig +0 -0
- metadata +1048 -1047
- 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: 2708181386dc2ec2ea46e5ffe3f96967c3ea1e23dfd6f0d6d6ef15fbbde3877a
|
4
|
+
data.tar.gz: 017f64d2a62cc0215b6234cef24c8f0be74f75ed5fa688d32155047dbd56a7e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2488655223e41488f275a7c8d1cd8b4c416a44a92c31cba63ab3fca21b27ec8f545b5feaa953aefb50035dbc68fe47db4f3aebb97fcb1de4e0e5fc6e3b186014
|
7
|
+
data.tar.gz: 671ae924600e906df4a2c209b7c491be445ef5c7c7030f6869fa991c53bd49a7cb728a718c8667b5c948022fb2912d45af437c1cf5b82f8b7ec0f0c849916045
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -115,11 +115,14 @@ module Mongo
|
|
115
115
|
end
|
116
116
|
command.update(view_options)
|
117
117
|
command.update(Utils.slice_hash(options, :collation))
|
118
|
+
|
118
119
|
# Read preference isn't simply passed in the command payload
|
119
|
-
# (it may need to be converted to wire protocol flags)
|
120
|
-
#
|
121
|
-
#
|
122
|
-
|
120
|
+
# (it may need to be converted to wire protocol flags).
|
121
|
+
# Ideally it should be removed here, however due to Mongoid 7
|
122
|
+
# using this method and requiring :read to be returned from it,
|
123
|
+
# we cannot do this just yet - see RUBY-2932.
|
124
|
+
#command.delete(:read)
|
125
|
+
|
123
126
|
command.merge!(Options::Mapper.transform_documents(options, MAPPINGS))
|
124
127
|
command
|
125
128
|
end
|
@@ -248,7 +248,20 @@ module Mongo
|
|
248
248
|
end
|
249
249
|
|
250
250
|
def initial_query_op(session)
|
251
|
-
|
251
|
+
spec = map_reduce_spec(session)
|
252
|
+
# Read preference isn't simply passed in the command payload
|
253
|
+
# (it may need to be converted to wire protocol flags).
|
254
|
+
# Passing it in command payload produces errors on at least
|
255
|
+
# 5.0 mongoses.
|
256
|
+
# In the future map_reduce_command should remove :read
|
257
|
+
# from its return value, however we cannot do this right now
|
258
|
+
# due to Mongoid 7 relying on :read being returned as part of
|
259
|
+
# the command - see RUBY-2932.
|
260
|
+
# Delete :read here for now because it cannot be sent to mongos this way.
|
261
|
+
spec = spec.dup
|
262
|
+
spec[:selector] = spec[:selector].dup
|
263
|
+
spec[:selector].delete(:read)
|
264
|
+
Operation::MapReduce.new(spec)
|
252
265
|
end
|
253
266
|
|
254
267
|
def valid_server?(server)
|
data/lib/mongo/version.rb
CHANGED
data/spec/lite_spec_helper.rb
CHANGED
@@ -157,6 +157,13 @@ RSpec.configure do |config|
|
|
157
157
|
end
|
158
158
|
|
159
159
|
if SpecConfig.instance.active_support?
|
160
|
+
require "active_support/version"
|
161
|
+
if ActiveSupport.version >= Gem::Version.new(7)
|
162
|
+
# ActiveSupport wants us to require ALL of it all of the time.
|
163
|
+
# See: https://github.com/rails/rails/issues/43851,
|
164
|
+
# https://github.com/rails/rails/issues/43889, etc.
|
165
|
+
require 'active_support'
|
166
|
+
end
|
160
167
|
require "active_support/time"
|
161
168
|
require 'mongo/active_support'
|
162
169
|
end
|
@@ -865,4 +865,20 @@ describe Mongo::Collection::View::MapReduce do
|
|
865
865
|
end
|
866
866
|
end
|
867
867
|
end
|
868
|
+
|
869
|
+
describe '#map_reduce_spec' do
|
870
|
+
context 'when read preference is given' do
|
871
|
+
let(:view_options) do
|
872
|
+
{ read: {mode: :secondary} }
|
873
|
+
end
|
874
|
+
|
875
|
+
context 'selector' do
|
876
|
+
# For compatibility with released versions of Mongoid, this method
|
877
|
+
# must return read preference under the :read key.
|
878
|
+
it 'contains read preference' do
|
879
|
+
map_reduce_spec[:selector][:read].should == {'mode' => :secondary}
|
880
|
+
end
|
881
|
+
end
|
882
|
+
end
|
883
|
+
end
|
868
884
|
end
|
data/spec/runners/auth.rb
CHANGED
@@ -32,7 +32,7 @@ module Mongo
|
|
32
32
|
#
|
33
33
|
# @since 2.6.0
|
34
34
|
def initialize(test_path)
|
35
|
-
@spec =
|
35
|
+
@spec = ::Utils.load_spec_yaml_file(test_path)
|
36
36
|
@description = File.basename(test_path)
|
37
37
|
@spec_tests = @spec['tests']
|
38
38
|
@collection_name = @spec['collection_name']
|
data/spec/runners/cmap.rb
CHANGED
@@ -40,7 +40,7 @@ module Mongo
|
|
40
40
|
#
|
41
41
|
# @param [ String ] test_path The path to the file.
|
42
42
|
def initialize(test_path)
|
43
|
-
@test =
|
43
|
+
@test = ::Utils.load_spec_yaml_file(test_path)
|
44
44
|
|
45
45
|
@description = @test['description']
|
46
46
|
@pool_options = ::Utils.snakeize_hash(process_options(@test['poolOptions']))
|
data/spec/runners/crud/spec.rb
CHANGED
@@ -12,9 +12,7 @@ module Mongo
|
|
12
12
|
#
|
13
13
|
# @since 2.0.0
|
14
14
|
def initialize(test_path)
|
15
|
-
|
16
|
-
|
17
|
-
@spec = YAML.load(contents)
|
15
|
+
@spec = ::Utils.load_spec_yaml_file(test_path)
|
18
16
|
@description = File.basename(test_path)
|
19
17
|
@data = BSON::ExtJSON.parse_obj(@spec['data'])
|
20
18
|
@tests = @spec['tests']
|
data/spec/runners/gridfs.rb
CHANGED
data/spec/runners/sdam.rb
CHANGED
@@ -64,7 +64,7 @@ module Mongo
|
|
64
64
|
#
|
65
65
|
# @since 2.0.0
|
66
66
|
def initialize(test_path)
|
67
|
-
@test =
|
67
|
+
@test = ::Utils.load_spec_yaml_file(test_path)
|
68
68
|
@description = "#{@test['topology_description']['type']}: #{File.basename(test_path)}"
|
69
69
|
@heartbeat_frequency = @test['heartbeatFrequencyMS'] / 1000 if @test['heartbeatFrequencyMS']
|
70
70
|
@read_preference = @test['read_preference']
|
@@ -28,7 +28,7 @@ module Mongo
|
|
28
28
|
#
|
29
29
|
# @since 2.0.0
|
30
30
|
def initialize(test_path)
|
31
|
-
@test =
|
31
|
+
@test = ::Utils.load_spec_yaml_file(test_path)
|
32
32
|
@description = "#{File.basename(test_path)}: avg_rtt_ms: #{@test['avg_rtt_ms']}, new_rtt_ms: #{@test['new_rtt_ms']}," +
|
33
33
|
" new_avg_rtt: #{@test['new_avg_rtt']}"
|
34
34
|
@average_rtt = @test['avg_rtt_ms'] == 'NULL' ? nil : @test['avg_rtt_ms'].to_f / 1000
|
data/spec/support/utils.rb
CHANGED
@@ -595,4 +595,35 @@ module Utils
|
|
595
595
|
end
|
596
596
|
end
|
597
597
|
end
|
598
|
+
|
599
|
+
module_function def load_spec_yaml_file(path)
|
600
|
+
permitted_classes = [
|
601
|
+
BigDecimal,
|
602
|
+
Date,
|
603
|
+
Time,
|
604
|
+
Range,
|
605
|
+
Regexp,
|
606
|
+
Symbol,
|
607
|
+
BSON::Binary,
|
608
|
+
BSON::Code,
|
609
|
+
BSON::CodeWithScope,
|
610
|
+
BSON::DbPointer,
|
611
|
+
BSON::Decimal128,
|
612
|
+
BSON::Int32,
|
613
|
+
BSON::Int64,
|
614
|
+
BSON::MaxKey,
|
615
|
+
BSON::MinKey,
|
616
|
+
BSON::ObjectId,
|
617
|
+
BSON::Regexp::Raw,
|
618
|
+
BSON::Symbol::Raw,
|
619
|
+
BSON::Timestamp,
|
620
|
+
BSON::Undefined,
|
621
|
+
]
|
622
|
+
if RUBY_VERSION < '2.6'
|
623
|
+
YAML.safe_load(File.read(path), permitted_classes, [], true)
|
624
|
+
else
|
625
|
+
# Here we have Ruby 2.6+ that supports the new syntax of `safe_load``.
|
626
|
+
YAML.safe_load(File.read(path), permitted_classes: permitted_classes, aliases: true)
|
627
|
+
end
|
628
|
+
end
|
598
629
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|