mongo 2.6.1 → 2.6.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 +4 -1
- data.tar.gz.sig +0 -0
- data/lib/mongo/client.rb +27 -16
- data/lib/mongo/cluster/topology/replica_set.rb +15 -3
- data/lib/mongo/error/lint_error.rb +1 -1
- data/lib/mongo/server/description.rb +1 -1
- data/lib/mongo/version.rb +1 -1
- data/spec/{mongo → integration}/change_stream_examples_spec.rb +0 -0
- data/spec/{mongo → integration}/docs_examples_spec.rb +0 -0
- data/spec/integration/reconnect_spec.rb +31 -0
- data/spec/{mongo → integration}/retryable_writes_spec.rb +0 -0
- data/spec/{mongo → integration}/shell_examples_spec.rb +0 -0
- data/spec/{mongo → integration}/transactions_examples_spec.rb +46 -61
- data/spec/lite_spec_helper.rb +7 -2
- data/spec/mongo/address/unix_spec.rb +1 -1
- data/spec/mongo/address_spec.rb +10 -10
- data/spec/mongo/auth/scram/conversation_spec.rb +2 -1
- data/spec/mongo/auth/scram/negotiation_spec.rb +6 -5
- data/spec/mongo/auth/scram_spec.rb +5 -4
- data/spec/mongo/bulk_write_spec.rb +3 -2
- data/spec/mongo/client_spec.rb +15 -7
- data/spec/mongo/cluster/topology/replica_set_spec.rb +46 -10
- data/spec/mongo/cluster_spec.rb +3 -3
- data/spec/mongo/collection/view/aggregation_spec.rb +2 -1
- data/spec/mongo/collection/view/readable_spec.rb +2 -1
- data/spec/mongo/collection_spec.rb +40 -23
- data/spec/mongo/database_spec.rb +3 -3
- data/spec/mongo/index/view_spec.rb +4 -2
- data/spec/mongo/server/connection_pool_spec.rb +1 -1
- data/spec/mongo/socket/ssl_spec.rb +3 -3
- data/spec/mongo/socket/unix_spec.rb +1 -1
- data/spec/mongo/socket_spec.rb +2 -2
- data/spec/mongo/uri/srv_protocol_spec.rb +2 -1
- data/spec/mongo/uri_spec.rb +6 -5
- data/spec/spec_helper.rb +7 -28
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +61 -63
- data/spec/spec_tests/sdam_monitoring_spec.rb +10 -7
- data/spec/{mongo → spec_tests}/transactions_spec.rb +8 -3
- data/spec/support/authorization.rb +10 -55
- data/spec/support/constraints.rb +34 -10
- data/spec/support/lite_constraints.rb +18 -0
- data/spec/support/sdam/rs/secondary_ignore_ok_0.yml +85 -0
- data/spec/support/spec_config.rb +73 -0
- data/spec/support/transactions.rb +1 -1
- metadata +170 -162
- metadata.gz.sig +1 -2
@@ -26,7 +26,8 @@ module Mongo
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
describe 'SCRAM-SHA auth mechanism negotiation'
|
29
|
+
describe 'SCRAM-SHA auth mechanism negotiation' do
|
30
|
+
require_scram_sha_256_support
|
30
31
|
|
31
32
|
URI_OPTION_MAP = {
|
32
33
|
:auth_source => 'authsource',
|
@@ -65,7 +66,7 @@ describe 'SCRAM-SHA auth mechanism negotiation', if: scram_sha_256_enabled? do
|
|
65
66
|
end
|
66
67
|
|
67
68
|
Mongo::Client.new(
|
68
|
-
|
69
|
+
SpecConfig.instance.addresses,
|
69
70
|
TEST_OPTIONS.merge(opts)
|
70
71
|
)
|
71
72
|
end
|
@@ -310,11 +311,11 @@ describe 'SCRAM-SHA auth mechanism negotiation', if: scram_sha_256_enabled? do
|
|
310
311
|
context 'when the configuration is specified in the URI' do
|
311
312
|
|
312
313
|
let(:uri) do
|
313
|
-
"mongodb://#{user.name}:#{password}@#{
|
314
|
+
"mongodb://#{user.name}:#{password}@#{SpecConfig.instance.addresses.join(',')}/admin".tap do |uri|
|
314
315
|
first = true
|
315
316
|
|
316
|
-
if
|
317
|
-
|
317
|
+
if SpecConfig.instance.uri_options
|
318
|
+
SpecConfig.instance.uri_options.each do |k, v|
|
318
319
|
uri << (first ? '?' : '&')
|
319
320
|
first = false
|
320
321
|
|
@@ -101,6 +101,7 @@ describe Mongo::Auth::SCRAM do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
context 'when SCRAM-SHA-256 is used' do
|
104
|
+
require_scram_sha_256_support
|
104
105
|
|
105
106
|
describe '#login' do
|
106
107
|
|
@@ -119,13 +120,13 @@ describe Mongo::Auth::SCRAM do
|
|
119
120
|
described_class.new(user)
|
120
121
|
end
|
121
122
|
|
122
|
-
it 'raises an exception'
|
123
|
+
it 'raises an exception' do
|
123
124
|
expect {
|
124
125
|
cr.login(connection)
|
125
126
|
}.to raise_error(Mongo::Auth::Unauthorized)
|
126
127
|
end
|
127
128
|
|
128
|
-
context 'when compression is used', if:
|
129
|
+
context 'when compression is used', if: testing_compression? do
|
129
130
|
|
130
131
|
it 'does not compress the message' do
|
131
132
|
expect(Mongo::Protocol::Compressed).not_to receive(:new)
|
@@ -150,12 +151,12 @@ describe Mongo::Auth::SCRAM do
|
|
150
151
|
test_user.instance_variable_set(:@client_key, nil)
|
151
152
|
end
|
152
153
|
|
153
|
-
it 'logs the user into the connection and caches the client key'
|
154
|
+
it 'logs the user into the connection and caches the client key' do
|
154
155
|
expect(login['ok']).to eq(1)
|
155
156
|
expect(test_user.send(:client_key)).not_to be_nil
|
156
157
|
end
|
157
158
|
|
158
|
-
it 'raises an exception when an incorrect client key is set'
|
159
|
+
it 'raises an exception when an incorrect client key is set' do
|
159
160
|
test_user.instance_variable_set(:@client_key, "incorrect client key")
|
160
161
|
expect {
|
161
162
|
cr.login(connection)
|
@@ -424,7 +424,7 @@ describe Mongo::BulkWrite do
|
|
424
424
|
}])
|
425
425
|
end
|
426
426
|
|
427
|
-
let(:selector) do
|
427
|
+
let(:selector) do
|
428
428
|
{ '$or' => [{ _id: 1 }, { _id: 2 }]}
|
429
429
|
end
|
430
430
|
|
@@ -2136,7 +2136,8 @@ describe Mongo::BulkWrite do
|
|
2136
2136
|
end
|
2137
2137
|
end
|
2138
2138
|
|
2139
|
-
describe 'when the collection has a validator'
|
2139
|
+
describe 'when the collection has a validator' do
|
2140
|
+
min_server_version '3.2'
|
2140
2141
|
|
2141
2142
|
before do
|
2142
2143
|
collection_with_validator.insert_many([{ :a => 1 }, { :a => 2 }])
|
data/spec/mongo/client_spec.rb
CHANGED
@@ -34,14 +34,14 @@ describe Mongo::Client do
|
|
34
34
|
expect do
|
35
35
|
client = described_class.new(['127.0.0.1:27017'],
|
36
36
|
:read => {:mode => :bogus})
|
37
|
-
end.to raise_error(Mongo::Error::InvalidReadOption, 'Invalid read option: {
|
37
|
+
end.to raise_error(Mongo::Error::InvalidReadOption, 'Invalid read option: {"mode"=>:bogus}: mode bogus is not one of recognized modes')
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'rejects bogus read preference as string' do
|
41
41
|
expect do
|
42
42
|
client = described_class.new(['127.0.0.1:27017'],
|
43
43
|
:read => {:mode => 'bogus'})
|
44
|
-
end.to raise_error(Mongo::Error::InvalidReadOption, 'Invalid read option: {
|
44
|
+
end.to raise_error(Mongo::Error::InvalidReadOption, 'Invalid read option: {"mode"=>"bogus"}: mode bogus is not one of recognized modes')
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'rejects read option specified as a string' do
|
@@ -717,7 +717,8 @@ describe Mongo::Client do
|
|
717
717
|
|
718
718
|
context 'when providing a connection string' do
|
719
719
|
|
720
|
-
context 'when the string uses the SRV Protocol'
|
720
|
+
context 'when the string uses the SRV Protocol' do
|
721
|
+
require_external_connectivity
|
721
722
|
|
722
723
|
let!(:uri) do
|
723
724
|
'mongodb+srv://test5.test.build.10gen.cc/testdb'
|
@@ -1468,7 +1469,7 @@ describe Mongo::Client do
|
|
1468
1469
|
end
|
1469
1470
|
|
1470
1471
|
let(:client) do
|
1471
|
-
Mongo::Client.new(
|
1472
|
+
Mongo::Client.new(SpecConfig.instance.addresses, client_options).tap do |cl|
|
1472
1473
|
cl.subscribe(Mongo::Monitoring::COMMAND, EventSubscriber.clear_events!)
|
1473
1474
|
end
|
1474
1475
|
end
|
@@ -1481,6 +1482,10 @@ describe Mongo::Client do
|
|
1481
1482
|
client.list_databases({}, true)
|
1482
1483
|
end
|
1483
1484
|
|
1485
|
+
after do
|
1486
|
+
client.close
|
1487
|
+
end
|
1488
|
+
|
1484
1489
|
it 'sends the command with the nameOnly flag set to true' do
|
1485
1490
|
expect(command[:nameOnly]).to be(true)
|
1486
1491
|
end
|
@@ -1548,11 +1553,14 @@ describe Mongo::Client do
|
|
1548
1553
|
described_class.new(['127.0.0.1:27017'])
|
1549
1554
|
end
|
1550
1555
|
|
1551
|
-
|
1552
|
-
|
1556
|
+
it 'replaces the cluster' do
|
1557
|
+
old_id = client.cluster.object_id
|
1558
|
+
client.reconnect
|
1559
|
+
new_id = client.cluster.object_id
|
1560
|
+
expect(new_id).not_to eql(old_id)
|
1553
1561
|
end
|
1554
1562
|
|
1555
|
-
it '
|
1563
|
+
it 'returns true' do
|
1556
1564
|
expect(client.reconnect).to be(true)
|
1557
1565
|
end
|
1558
1566
|
end
|
@@ -514,6 +514,9 @@ describe Mongo::Cluster::Topology::ReplicaSet do
|
|
514
514
|
allow(d).to receive(:replica_set_name).and_return('test')
|
515
515
|
allow(d).to receive(:is_server?).and_return(true)
|
516
516
|
allow(d).to receive(:ghost?).and_return(false)
|
517
|
+
allow(d).to receive(:address).and_return(address)
|
518
|
+
allow(d).to receive(:me_mismatch?).and_return(false)
|
519
|
+
allow(d).to receive(:unknown?).and_return(false)
|
517
520
|
end
|
518
521
|
end
|
519
522
|
|
@@ -533,6 +536,10 @@ describe Mongo::Cluster::Topology::ReplicaSet do
|
|
533
536
|
allow(d).to receive(:replica_set_name).and_return('testing')
|
534
537
|
allow(d).to receive(:lists_server?).and_return(true)
|
535
538
|
allow(d).to receive(:servers).and_return([double('server')])
|
539
|
+
allow(d).to receive(:address).and_return(address)
|
540
|
+
allow(d).to receive(:me_mismatch?).and_return(false)
|
541
|
+
allow(d).to receive(:unknown?).and_return(false)
|
542
|
+
allow(d).to receive(:server_type).and_return(:secondary)
|
536
543
|
end
|
537
544
|
end
|
538
545
|
|
@@ -543,19 +550,46 @@ describe Mongo::Cluster::Topology::ReplicaSet do
|
|
543
550
|
|
544
551
|
context 'when the description does not include the server in question' do
|
545
552
|
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
553
|
+
context 'when the description is primary' do
|
554
|
+
let(:description) do
|
555
|
+
double('description').tap do |d|
|
556
|
+
allow(d).to receive(:config).and_return({ 'setName' => 'testing' })
|
557
|
+
allow(d).to receive(:replica_set_member?).and_return(true)
|
558
|
+
allow(d).to receive(:replica_set_name).and_return('testing')
|
559
|
+
allow(d).to receive(:is_server?).and_return(false)
|
560
|
+
allow(d).to receive(:lists_server?).and_return(false)
|
561
|
+
allow(d).to receive(:servers).and_return([double('server')])
|
562
|
+
allow(d).to receive(:address).and_return("127.0.0.1:27018")
|
563
|
+
allow(d).to receive(:me_mismatch?).and_return(false)
|
564
|
+
allow(d).to receive(:unknown?).and_return(false)
|
565
|
+
allow(d).to receive(:server_type).and_return(:primary)
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
it 'returns true' do
|
570
|
+
expect(topology.remove_server?(description, secondary)).to eq(true)
|
554
571
|
end
|
555
572
|
end
|
556
573
|
|
557
|
-
|
558
|
-
|
574
|
+
context 'when the description is not' do
|
575
|
+
let(:description) do
|
576
|
+
double('description').tap do |d|
|
577
|
+
allow(d).to receive(:config).and_return({ 'setName' => 'testing' })
|
578
|
+
allow(d).to receive(:replica_set_member?).and_return(true)
|
579
|
+
allow(d).to receive(:replica_set_name).and_return('testing')
|
580
|
+
allow(d).to receive(:is_server?).and_return(false)
|
581
|
+
allow(d).to receive(:lists_server?).and_return(false)
|
582
|
+
allow(d).to receive(:servers).and_return([double('server')])
|
583
|
+
allow(d).to receive(:address).and_return('127.0.0.1:27018')
|
584
|
+
allow(d).to receive(:me_mismatch?).and_return(false)
|
585
|
+
allow(d).to receive(:unknown?).and_return(false)
|
586
|
+
allow(d).to receive(:server_type).and_return(:secondary)
|
587
|
+
end
|
588
|
+
end
|
589
|
+
|
590
|
+
it 'returns false' do
|
591
|
+
expect(topology.remove_server?(description, secondary)).to eq(false)
|
592
|
+
end
|
559
593
|
end
|
560
594
|
end
|
561
595
|
end
|
@@ -568,6 +602,8 @@ describe Mongo::Cluster::Topology::ReplicaSet do
|
|
568
602
|
allow(d).to receive(:replica_set_member?).and_return(true)
|
569
603
|
allow(d).to receive(:replica_set_name).and_return('test')
|
570
604
|
allow(d).to receive(:is_server?).and_return(false)
|
605
|
+
allow(d).to receive(:address).and_return('127.0.0.1:27018')
|
606
|
+
allow(d).to receive(:unknown?).and_return(false)
|
571
607
|
end
|
572
608
|
end
|
573
609
|
|
data/spec/mongo/cluster_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe Mongo::Cluster do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
let(:cluster) do
|
10
|
-
described_class.new(
|
10
|
+
described_class.new(SpecConfig.instance.addresses, monitoring, TEST_OPTIONS)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe '#==' do
|
@@ -19,7 +19,7 @@ describe Mongo::Cluster do
|
|
19
19
|
context 'when the options are the same' do
|
20
20
|
|
21
21
|
let(:other) do
|
22
|
-
described_class.new(
|
22
|
+
described_class.new(SpecConfig.instance.addresses, monitoring, TEST_OPTIONS)
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'returns true' do
|
@@ -594,7 +594,7 @@ describe Mongo::Cluster do
|
|
594
594
|
describe '#update_cluster_time' do
|
595
595
|
|
596
596
|
let(:cluster) do
|
597
|
-
described_class.new(
|
597
|
+
described_class.new(SpecConfig.instance.addresses, monitoring, TEST_OPTIONS.merge(heartbeat_frequency: 1000))
|
598
598
|
end
|
599
599
|
|
600
600
|
let(:result) do
|
@@ -147,7 +147,8 @@ describe Mongo::Collection::View::Aggregation do
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
context 'when the initial response has no results but an active cursor'
|
150
|
+
context 'when the initial response has no results but an active cursor' do
|
151
|
+
min_server_version '3.2'
|
151
152
|
|
152
153
|
let(:documents) do
|
153
154
|
[
|
@@ -20,7 +20,8 @@ describe Mongo::Collection::View::Readable do
|
|
20
20
|
|
21
21
|
shared_examples_for 'a read concern aware operation' do
|
22
22
|
|
23
|
-
context 'when a read concern is provided'
|
23
|
+
context 'when a read concern is provided' do
|
24
|
+
min_server_version '3.2'
|
24
25
|
|
25
26
|
let(:new_view) do
|
26
27
|
Mongo::Collection::View.new(new_collection, selector, options)
|
@@ -101,7 +101,7 @@ describe Mongo::Collection do
|
|
101
101
|
describe '#with' do
|
102
102
|
|
103
103
|
let(:client) do
|
104
|
-
Mongo::Client.new(
|
104
|
+
Mongo::Client.new(SpecConfig.instance.addresses, TEST_OPTIONS)
|
105
105
|
end
|
106
106
|
|
107
107
|
let(:database) do
|
@@ -133,7 +133,7 @@ describe Mongo::Collection do
|
|
133
133
|
context 'when the client has a server selection timeout setting' do
|
134
134
|
|
135
135
|
let(:client) do
|
136
|
-
Mongo::Client.new(
|
136
|
+
Mongo::Client.new(SpecConfig.instance.addresses, TEST_OPTIONS.merge(server_selection_timeout: 2))
|
137
137
|
end
|
138
138
|
|
139
139
|
it 'passes the the server_selection_timeout to the cluster' do
|
@@ -144,7 +144,7 @@ describe Mongo::Collection do
|
|
144
144
|
context 'when the client has a read preference set' do
|
145
145
|
|
146
146
|
let(:client) do
|
147
|
-
Mongo::Client.new(
|
147
|
+
Mongo::Client.new(SpecConfig.instance.addresses, TEST_OPTIONS.merge(read: { mode: :primary_preferred }))
|
148
148
|
end
|
149
149
|
|
150
150
|
it 'sets the new read options on the new collection' do
|
@@ -156,7 +156,7 @@ describe Mongo::Collection do
|
|
156
156
|
context 'when the client has a read preference and server selection timeout set' do
|
157
157
|
|
158
158
|
let(:client) do
|
159
|
-
Mongo::Client.new(
|
159
|
+
Mongo::Client.new(SpecConfig.instance.addresses, TEST_OPTIONS.merge(read: { mode: :primary_preferred }, server_selection_timeout: 2))
|
160
160
|
end
|
161
161
|
|
162
162
|
it 'sets the new read options on the new collection' do
|
@@ -186,7 +186,7 @@ describe Mongo::Collection do
|
|
186
186
|
context 'when the client has a write concern set' do
|
187
187
|
|
188
188
|
let(:client) do
|
189
|
-
Mongo::Client.new(
|
189
|
+
Mongo::Client.new(SpecConfig.instance.addresses, TEST_OPTIONS.merge(write: INVALID_WRITE_CONCERN))
|
190
190
|
end
|
191
191
|
|
192
192
|
it 'sets the new write options on the new collection' do
|
@@ -219,7 +219,7 @@ describe Mongo::Collection do
|
|
219
219
|
context 'when the client has a server selection timeout setting' do
|
220
220
|
|
221
221
|
let(:client) do
|
222
|
-
Mongo::Client.new(
|
222
|
+
Mongo::Client.new(SpecConfig.instance.addresses, TEST_OPTIONS.merge(server_selection_timeout: 2))
|
223
223
|
end
|
224
224
|
|
225
225
|
it 'passes the server_selection_timeout setting to the cluster' do
|
@@ -230,7 +230,7 @@ describe Mongo::Collection do
|
|
230
230
|
context 'when the client has a read preference set' do
|
231
231
|
|
232
232
|
let(:client) do
|
233
|
-
Mongo::Client.new(
|
233
|
+
Mongo::Client.new(SpecConfig.instance.addresses, TEST_OPTIONS.merge(read: { mode: :primary_preferred }))
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'sets the new read options on the new collection' do
|
@@ -489,7 +489,8 @@ describe Mongo::Collection do
|
|
489
489
|
|
490
490
|
it_behaves_like 'a capped collection command'
|
491
491
|
|
492
|
-
context 'when validators can be set'
|
492
|
+
context 'when validators can be set' do
|
493
|
+
min_server_version '3.2'
|
493
494
|
it_behaves_like 'a validated collection command'
|
494
495
|
end
|
495
496
|
end
|
@@ -502,7 +503,8 @@ describe Mongo::Collection do
|
|
502
503
|
|
503
504
|
it_behaves_like 'a capped collection command'
|
504
505
|
|
505
|
-
context 'when validators can be set'
|
506
|
+
context 'when validators can be set' do
|
507
|
+
min_server_version '3.2'
|
506
508
|
it_behaves_like 'a validated collection command'
|
507
509
|
end
|
508
510
|
end
|
@@ -1241,7 +1243,8 @@ describe Mongo::Collection do
|
|
1241
1243
|
end
|
1242
1244
|
end
|
1243
1245
|
|
1244
|
-
context 'when collection has a validator'
|
1246
|
+
context 'when collection has a validator' do
|
1247
|
+
min_server_version '3.2'
|
1245
1248
|
|
1246
1249
|
around(:each) do |spec|
|
1247
1250
|
authorized_client[:validating,
|
@@ -1446,7 +1449,8 @@ describe Mongo::Collection do
|
|
1446
1449
|
end
|
1447
1450
|
end
|
1448
1451
|
|
1449
|
-
context 'when collection has a validator'
|
1452
|
+
context 'when collection has a validator' do
|
1453
|
+
min_server_version '3.2'
|
1450
1454
|
|
1451
1455
|
around(:each) do |spec|
|
1452
1456
|
authorized_client[:validating,
|
@@ -2327,6 +2331,7 @@ describe Mongo::Collection do
|
|
2327
2331
|
end
|
2328
2332
|
|
2329
2333
|
describe '#parallel_scan', unless: sharded? do
|
2334
|
+
max_server_version '4.0'
|
2330
2335
|
|
2331
2336
|
let(:documents) do
|
2332
2337
|
(1..200).map do |i|
|
@@ -2423,7 +2428,8 @@ describe Mongo::Collection do
|
|
2423
2428
|
it_behaves_like 'an operation supporting causally consistent reads'
|
2424
2429
|
end
|
2425
2430
|
|
2426
|
-
context 'when a read concern is provided'
|
2431
|
+
context 'when a read concern is provided' do
|
2432
|
+
min_server_version '3.2'
|
2427
2433
|
|
2428
2434
|
let(:result) do
|
2429
2435
|
authorized_collection.with(options).parallel_scan(2)
|
@@ -2615,7 +2621,8 @@ describe Mongo::Collection do
|
|
2615
2621
|
end
|
2616
2622
|
end
|
2617
2623
|
|
2618
|
-
context 'when collection has a validator'
|
2624
|
+
context 'when collection has a validator' do
|
2625
|
+
min_server_version '3.2'
|
2619
2626
|
|
2620
2627
|
around(:each) do |spec|
|
2621
2628
|
authorized_client[:validating,
|
@@ -3027,7 +3034,8 @@ describe Mongo::Collection do
|
|
3027
3034
|
end
|
3028
3035
|
end
|
3029
3036
|
|
3030
|
-
context 'when collection has a validator'
|
3037
|
+
context 'when collection has a validator' do
|
3038
|
+
min_server_version '3.2'
|
3031
3039
|
|
3032
3040
|
around(:each) do |spec|
|
3033
3041
|
authorized_client[:validating,
|
@@ -3344,7 +3352,8 @@ describe Mongo::Collection do
|
|
3344
3352
|
end
|
3345
3353
|
end
|
3346
3354
|
|
3347
|
-
context 'when collection has a validator'
|
3355
|
+
context 'when collection has a validator' do
|
3356
|
+
min_server_version '3.2'
|
3348
3357
|
|
3349
3358
|
around(:each) do |spec|
|
3350
3359
|
authorized_client[:validating,
|
@@ -3781,7 +3790,8 @@ describe Mongo::Collection do
|
|
3781
3790
|
end
|
3782
3791
|
end
|
3783
3792
|
|
3784
|
-
context 'when write_concern is provided', if:
|
3793
|
+
context 'when write_concern is provided', if: standalone? do
|
3794
|
+
min_server_version '3.2'
|
3785
3795
|
|
3786
3796
|
it 'uses the write concern' do
|
3787
3797
|
expect {
|
@@ -3791,7 +3801,8 @@ describe Mongo::Collection do
|
|
3791
3801
|
end
|
3792
3802
|
end
|
3793
3803
|
|
3794
|
-
context 'when the collection has a write concern', if:
|
3804
|
+
context 'when the collection has a write concern', if: standalone? do
|
3805
|
+
min_server_version '3.2'
|
3795
3806
|
|
3796
3807
|
let(:collection) do
|
3797
3808
|
authorized_collection.with(write: { w: 2 })
|
@@ -4049,7 +4060,8 @@ describe Mongo::Collection do
|
|
4049
4060
|
end
|
4050
4061
|
end
|
4051
4062
|
|
4052
|
-
context 'when collection has a validator'
|
4063
|
+
context 'when collection has a validator' do
|
4064
|
+
min_server_version '3.2'
|
4053
4065
|
|
4054
4066
|
around(:each) do |spec|
|
4055
4067
|
authorized_client[:validating,
|
@@ -4108,7 +4120,8 @@ describe Mongo::Collection do
|
|
4108
4120
|
end
|
4109
4121
|
end
|
4110
4122
|
|
4111
|
-
context 'when write_concern is provided', if:
|
4123
|
+
context 'when write_concern is provided', if: standalone? do
|
4124
|
+
min_server_version '3.2'
|
4112
4125
|
|
4113
4126
|
it 'uses the write concern' do
|
4114
4127
|
expect {
|
@@ -4119,7 +4132,8 @@ describe Mongo::Collection do
|
|
4119
4132
|
end
|
4120
4133
|
end
|
4121
4134
|
|
4122
|
-
context 'when the collection has a write concern', if:
|
4135
|
+
context 'when the collection has a write concern', if: standalone? do
|
4136
|
+
min_server_version '3.2'
|
4123
4137
|
|
4124
4138
|
let(:collection) do
|
4125
4139
|
authorized_collection.with(write: { w: 2 })
|
@@ -4434,7 +4448,8 @@ describe Mongo::Collection do
|
|
4434
4448
|
end
|
4435
4449
|
end
|
4436
4450
|
|
4437
|
-
context 'when collection has a validator'
|
4451
|
+
context 'when collection has a validator' do
|
4452
|
+
min_server_version '3.2'
|
4438
4453
|
|
4439
4454
|
around(:each) do |spec|
|
4440
4455
|
authorized_client[:validating,
|
@@ -4493,7 +4508,8 @@ describe Mongo::Collection do
|
|
4493
4508
|
end
|
4494
4509
|
end
|
4495
4510
|
|
4496
|
-
context 'when write_concern is provided', if:
|
4511
|
+
context 'when write_concern is provided', if: standalone? do
|
4512
|
+
min_server_version '3.2'
|
4497
4513
|
|
4498
4514
|
it 'uses the write concern' do
|
4499
4515
|
expect {
|
@@ -4504,7 +4520,8 @@ describe Mongo::Collection do
|
|
4504
4520
|
end
|
4505
4521
|
end
|
4506
4522
|
|
4507
|
-
context 'when the collection has a write concern', if:
|
4523
|
+
context 'when the collection has a write concern', if: standalone? do
|
4524
|
+
min_server_version '3.2'
|
4508
4525
|
|
4509
4526
|
let(:collection) do
|
4510
4527
|
authorized_collection.with(write: { w: 2 })
|