mongo 2.7.0 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +39 -14
  5. data/Rakefile +1 -0
  6. data/lib/mongo/auth.rb +4 -1
  7. data/lib/mongo/client.rb +4 -3
  8. data/lib/mongo/cluster.rb +1 -1
  9. data/lib/mongo/collection/view/readable.rb +5 -2
  10. data/lib/mongo/database.rb +1 -0
  11. data/lib/mongo/error/invalid_server_preference.rb +1 -0
  12. data/lib/mongo/error/operation_failure.rb +10 -0
  13. data/lib/mongo/error/parser.rb +10 -0
  14. data/lib/mongo/event.rb +1 -2
  15. data/lib/mongo/operation/result.rb +4 -1
  16. data/lib/mongo/operation/shared/executable_transaction_label.rb +3 -1
  17. data/lib/mongo/operation/shared/sessions_supported.rb +1 -1
  18. data/lib/mongo/protocol/msg.rb +1 -1
  19. data/lib/mongo/protocol/query.rb +2 -2
  20. data/lib/mongo/retryable.rb +20 -6
  21. data/lib/mongo/server.rb +6 -0
  22. data/lib/mongo/server/connection.rb +4 -4
  23. data/lib/mongo/server/monitor/connection.rb +9 -5
  24. data/lib/mongo/server_selector/selectable.rb +86 -32
  25. data/lib/mongo/session.rb +98 -15
  26. data/lib/mongo/version.rb +1 -1
  27. data/spec/README.md +85 -0
  28. data/spec/integration/bulk_insert_spec.rb +1 -1
  29. data/spec/integration/change_stream_examples_spec.rb +3 -1
  30. data/spec/integration/change_stream_spec.rb +10 -14
  31. data/spec/integration/client_construction_spec.rb +1 -0
  32. data/spec/integration/command_monitoring_spec.rb +37 -1
  33. data/spec/integration/command_spec.rb +141 -0
  34. data/spec/integration/connection_spec.rb +4 -2
  35. data/spec/integration/cursor_reaping_spec.rb +1 -1
  36. data/spec/integration/docs_examples_spec.rb +1 -1
  37. data/spec/integration/retryable_writes_spec.rb +33 -42
  38. data/spec/integration/server_description_spec.rb +3 -3
  39. data/spec/integration/server_selector_spec.rb +79 -0
  40. data/spec/lite_spec_helper.rb +4 -2
  41. data/spec/mongo/address_spec.rb +8 -0
  42. data/spec/mongo/auth/cr_spec.rb +5 -2
  43. data/spec/mongo/auth/invalid_mechanism_spec.rb +11 -0
  44. data/spec/mongo/auth/scram/conversation_spec.rb +3 -2
  45. data/spec/mongo/auth/scram/negotiation_spec.rb +1 -2
  46. data/spec/mongo/auth/scram_spec.rb +11 -6
  47. data/spec/mongo/auth/user/view_spec.rb +13 -6
  48. data/spec/mongo/bulk_write_spec.rb +81 -104
  49. data/spec/mongo/client_construction_spec.rb +18 -7
  50. data/spec/mongo/client_spec.rb +11 -7
  51. data/spec/mongo/cluster_spec.rb +30 -1
  52. data/spec/mongo/collection/view/aggregation_spec.rb +18 -10
  53. data/spec/mongo/collection/view/change_stream_spec.rb +28 -8
  54. data/spec/mongo/collection/view/map_reduce_spec.rb +24 -10
  55. data/spec/mongo/collection/view/readable_spec.rb +37 -19
  56. data/spec/mongo/collection/view/writable_spec.rb +64 -32
  57. data/spec/mongo/collection/view_spec.rb +4 -2
  58. data/spec/mongo/collection_spec.rb +163 -73
  59. data/spec/mongo/cursor_spec.rb +5 -2
  60. data/spec/mongo/database_spec.rb +41 -19
  61. data/spec/mongo/error/no_server_available_spec.rb +1 -1
  62. data/spec/mongo/error/parser_spec.rb +29 -0
  63. data/spec/mongo/grid/stream/write_spec.rb +2 -1
  64. data/spec/mongo/index/view_spec.rb +42 -24
  65. data/spec/mongo/operation/delete/op_msg_spec.rb +11 -7
  66. data/spec/mongo/operation/insert/op_msg_spec.rb +10 -6
  67. data/spec/mongo/operation/update/op_msg_spec.rb +10 -6
  68. data/spec/mongo/protocol/compressed_spec.rb +1 -1
  69. data/spec/mongo/protocol/msg_spec.rb +1 -1
  70. data/spec/mongo/server/app_metadata_spec.rb +2 -1
  71. data/spec/mongo/server/connection_auth_spec.rb +1 -1
  72. data/spec/mongo/server/monitor/connection_spec.rb +42 -0
  73. data/spec/mongo/server_selector_spec.rb +17 -0
  74. data/spec/mongo/server_spec.rb +110 -0
  75. data/spec/mongo/session/session_pool_spec.rb +1 -1
  76. data/spec/mongo/session_spec.rb +1 -1
  77. data/spec/mongo/session_transaction_spec.rb +162 -1
  78. data/spec/mongo/socket/ssl_spec.rb +14 -7
  79. data/spec/mongo/uri/srv_protocol_spec.rb +41 -34
  80. data/spec/spec_helper.rb +3 -191
  81. data/spec/spec_tests/change_streams_spec.rb +3 -6
  82. data/spec/spec_tests/data/transactions/abort.yml +3 -1
  83. data/spec/spec_tests/data/transactions/commit.yml +4 -3
  84. data/spec/spec_tests/data/transactions/error-labels.yml +17 -13
  85. data/spec/spec_tests/data/transactions/read-concern.yml +611 -0
  86. data/spec/spec_tests/data/transactions/retryable-commit.yml +126 -21
  87. data/spec/spec_tests/data/transactions_api/callback-aborts.yml +42 -39
  88. data/spec/spec_tests/data/transactions_api/callback-commits.yml +52 -50
  89. data/spec/spec_tests/data/transactions_api/callback-retry.yml +33 -31
  90. data/spec/spec_tests/data/transactions_api/commit-retry.yml +42 -39
  91. data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror-4.2.yml +13 -12
  92. data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror.yml +15 -26
  93. data/spec/spec_tests/data/transactions_api/commit-writeconcernerror.yml +25 -33
  94. data/spec/spec_tests/data/transactions_api/commit.yml +44 -42
  95. data/spec/spec_tests/data/transactions_api/transaction-options.yml +25 -23
  96. data/spec/spec_tests/max_staleness_spec.rb +2 -0
  97. data/spec/spec_tests/retryable_writes_spec.rb +2 -6
  98. data/spec/spec_tests/sdam_spec.rb +2 -0
  99. data/spec/spec_tests/server_selection_spec.rb +3 -0
  100. data/spec/spec_tests/transactions_api_spec.rb +7 -1
  101. data/spec/spec_tests/transactions_spec.rb +6 -0
  102. data/spec/spec_tests/uri_options_spec.rb +4 -26
  103. data/spec/support/certificates/ca.pem +21 -16
  104. data/spec/support/certificates/client.pem +90 -90
  105. data/spec/support/certificates/client_cert.pem +21 -20
  106. data/spec/support/certificates/client_key.pem +27 -28
  107. data/spec/support/certificates/client_key_encrypted.pem +26 -26
  108. data/spec/support/certificates/crl.pem +10 -8
  109. data/spec/support/certificates/crl_client_revoked.pem +11 -10
  110. data/spec/support/certificates/server.pem +48 -33
  111. data/spec/support/change_streams.rb +12 -32
  112. data/spec/support/client_registry.rb +12 -1
  113. data/spec/support/cluster_config.rb +48 -2
  114. data/spec/support/common_shortcuts.rb +73 -7
  115. data/spec/support/connection_string.rb +0 -3
  116. data/spec/support/constraints.rb +87 -22
  117. data/spec/support/crud.rb +2 -1
  118. data/spec/support/shared/server_selector.rb +0 -28
  119. data/spec/support/shared/session.rb +25 -14
  120. data/spec/support/transactions.rb +4 -8
  121. data/spec/support/transactions/operation.rb +26 -4
  122. data/spec/support/transactions/verifier.rb +5 -2
  123. metadata +496 -488
  124. metadata.gz.sig +5 -2
  125. data/spec/support/certificates/password_protected.pem +0 -51
@@ -356,7 +356,8 @@ describe Mongo::Cursor do
356
356
  end
357
357
  end
358
358
 
359
- context 'when an implicit session is used', if: sessions_enabled? do
359
+ context 'when an implicit session is used' do
360
+ min_server_fcv '3.6'
360
361
 
361
362
  let(:collection) do
362
363
  subscribed_client[TEST_COLL]
@@ -400,7 +401,9 @@ describe Mongo::Cursor do
400
401
  end
401
402
  end
402
403
 
403
- context 'when a getMore is needed to retrieve all results', if: sessions_enabled? && !sharded? do
404
+ context 'when a getMore is needed to retrieve all results' do
405
+ min_server_fcv '3.6'
406
+ require_topology :single, :replica_set
404
407
 
405
408
  let(:documents) do
406
409
  (1..4).map{ |i| { field: "test#{i}" }}
@@ -119,7 +119,7 @@ describe Mongo::Database do
119
119
 
120
120
  context 'when specifying a batch size' do
121
121
 
122
- it 'returns the stripped names of the collections', unless: need_to_skip_on_sharded_auth_40? do
122
+ it 'returns the stripped names of the collections' do
123
123
  expect(database.collection_names(batch_size: 1).to_a).to include('users')
124
124
  end
125
125
  end
@@ -135,7 +135,7 @@ describe Mongo::Database do
135
135
  end
136
136
  end
137
137
 
138
- it 'returns all collections', unless: need_to_skip_on_sharded_auth_40? do
138
+ it 'returns all collections' do
139
139
  expect(database.collection_names(batch_size: 1).select { |c| c =~ /dalmatians/}.size).to eq(2)
140
140
  end
141
141
 
@@ -159,12 +159,20 @@ describe Mongo::Database do
159
159
  database[:users].create
160
160
  end
161
161
 
162
- it 'returns a list of the collections info', if: list_command_enabled? do
163
- expect(result).to include('users')
162
+ context 'server 3.0+' do
163
+ min_server_fcv '3.0'
164
+
165
+ it 'returns a list of the collections info' do
166
+ expect(result).to include('users')
167
+ end
164
168
  end
165
169
 
166
- it 'returns a list of the collections info', unless: list_command_enabled? do
167
- expect(result).to include("#{SpecConfig.instance.test_db}.users")
170
+ context 'server 2.6' do
171
+ max_server_fcv '2.6'
172
+
173
+ it 'returns a list of the collections info' do
174
+ expect(result).to include("#{SpecConfig.instance.test_db}.users")
175
+ end
168
176
  end
169
177
  end
170
178
 
@@ -205,7 +213,8 @@ describe Mongo::Database do
205
213
  end
206
214
  end
207
215
 
208
- context 'when the user is not authorized', if: auth_enabled? do
216
+ context 'when the user is not authorized' do
217
+ require_auth
209
218
 
210
219
  let(:database) do
211
220
  described_class.new(unauthorized_client, SpecConfig.instance.test_db)
@@ -233,7 +242,8 @@ describe Mongo::Database do
233
242
  expect(database.command({:ismaster => 1}.freeze).written_count).to eq(0)
234
243
  end
235
244
 
236
- context 'when provided a session', if: sessions_enabled? do
245
+ context 'when provided a session' do
246
+ min_server_fcv '3.6'
237
247
 
238
248
  let(:operation) do
239
249
  client.database.command({ :ismaster => 1 }, session: session)
@@ -268,7 +278,7 @@ describe Mongo::Database do
268
278
  end
269
279
 
270
280
  context 'when a read concern is provided' do
271
- min_server_version '3.2'
281
+ min_server_fcv '3.2'
272
282
 
273
283
  context 'when the read concern is valid' do
274
284
 
@@ -280,7 +290,9 @@ describe Mongo::Database do
280
290
  end
281
291
 
282
292
  context 'when the read concern is not valid' do
283
- it 'raises an exception', if: !sharded? do
293
+ require_topology :single, :replica_set
294
+
295
+ it 'raises an exception' do
284
296
  expect {
285
297
  database.command(:ismaster => 1, readConcern: { level: 'yay' })
286
298
  }.to raise_error(Mongo::Error::OperationFailure)
@@ -288,7 +300,8 @@ describe Mongo::Database do
288
300
  end
289
301
  end
290
302
 
291
- context 'when no read preference is provided', unless: sharded? do
303
+ context 'when no read preference is provided' do
304
+ require_topology :single, :replica_set
292
305
 
293
306
  let!(:primary_server) do
294
307
  database.cluster.next_primary
@@ -303,7 +316,8 @@ describe Mongo::Database do
303
316
  end
304
317
  end
305
318
 
306
- context 'when the client has a read preference set', unless: sharded? do
319
+ context 'when the client has a read preference set' do
320
+ require_topology :single, :replica_set
307
321
 
308
322
  let!(:primary_server) do
309
323
  database.cluster.next_primary
@@ -330,7 +344,8 @@ describe Mongo::Database do
330
344
  end
331
345
  end
332
346
 
333
- context 'when there is a read preference argument provided', unless: sharded? do
347
+ context 'when there is a read preference argument provided' do
348
+ require_topology :single, :replica_set
334
349
 
335
350
  let(:read_preference) do
336
351
  { :mode => :secondary, :tag_sets => [{ 'non' => 'existent' }] }
@@ -355,7 +370,8 @@ describe Mongo::Database do
355
370
  end
356
371
  end
357
372
 
358
- context 'when the client has a server_selection_timeout set', unless: sharded? do
373
+ context 'when the client has a server_selection_timeout set' do
374
+ require_topology :single, :replica_set
359
375
 
360
376
  let(:client) do
361
377
  authorized_client.with(server_selection_timeout: 0)
@@ -374,7 +390,8 @@ describe Mongo::Database do
374
390
 
375
391
  context 'when a write concern is not defined on the client/database object' do
376
392
 
377
- context 'when a write concern is provided in the selector', if: standalone? do
393
+ context 'when a write concern is provided in the selector' do
394
+ require_topology :single
378
395
 
379
396
  let(:cmd) do
380
397
  {
@@ -418,7 +435,8 @@ describe Mongo::Database do
418
435
  end
419
436
  end
420
437
 
421
- context 'when a write concern is provided in the command selector', if: standalone? do
438
+ context 'when a write concern is provided in the command selector' do
439
+ require_topology :single
422
440
 
423
441
  let(:cmd) do
424
442
  {
@@ -477,7 +495,9 @@ describe Mongo::Database do
477
495
  client.database
478
496
  end
479
497
 
480
- context 'when the server supports write concern on the dropDatabase command', if: (collation_enabled? && standalone?) do
498
+ context 'when the server supports write concern on the dropDatabase command' do
499
+ min_server_fcv '3.4'
500
+ require_topology :single
481
501
 
482
502
  it 'applies the write concern' do
483
503
  expect{
@@ -486,7 +506,8 @@ describe Mongo::Database do
486
506
  end
487
507
  end
488
508
 
489
- context 'when the server does not support write concern on the dropDatabase command', unless: collation_enabled? do
509
+ context 'when the server does not support write concern on the dropDatabase command' do
510
+ max_server_version '3.2'
490
511
 
491
512
  it 'does not apply the write concern' do
492
513
  expect(database_with_write_options.drop).to be_successful
@@ -537,7 +558,8 @@ describe Mongo::Database do
537
558
  end
538
559
  end
539
560
 
540
- describe '#fs', unless: sharded? do
561
+ describe '#fs' do
562
+ require_topology :single, :replica_set
541
563
 
542
564
  let(:database) do
543
565
  described_class.new(authorized_client, SpecConfig.instance.test_db)
@@ -16,7 +16,7 @@ describe Mongo::Error::NoServerAvailable do
16
16
  end
17
17
 
18
18
  it 'is correct' do
19
- expect(error.message).to eq('No primary server is available in cluster: #<Cluster topology=Unknown[127.0.0.1:27017] servers=[]> with timeout=30, LT=0.015')
19
+ expect(error.message).to eq('No primary server is available in cluster: #<Cluster topology=Unknown[127.0.0.1:27017] servers=[#<Server address=127.0.0.1:27017 UNKNOWN>]> with timeout=30, LT=0.015')
20
20
  end
21
21
  end
22
22
  end
@@ -256,4 +256,33 @@ describe Mongo::Error::Parser do
256
256
  end
257
257
  end
258
258
  end
259
+
260
+ describe '#wtimeout' do
261
+ let(:parser) do
262
+ described_class.new(document)
263
+ end
264
+
265
+ context 'when document contains wtimeout' do
266
+ let(:document) do
267
+ { 'ok' => 1, 'writeConcernError' => {
268
+ 'errmsg' => 'replication timed out', 'code' => 64,
269
+ 'errInfo' => {'wtimeout' => true}} }
270
+ end
271
+
272
+ it 'returns true' do
273
+ expect(parser.wtimeout).to be true
274
+ end
275
+ end
276
+
277
+ context 'when document does not contain wtimeout' do
278
+ let(:document) do
279
+ { 'ok' => 1, 'writeConcernError' => {
280
+ 'errmsg' => 'replication did not time out', 'code' => 55 }}
281
+ end
282
+
283
+ it 'returns nil' do
284
+ expect(parser.wtimeout).to be nil
285
+ end
286
+ end
287
+ end
259
288
  end
@@ -96,7 +96,8 @@ describe Mongo::Grid::FSBucket::Stream::Write do
96
96
  end
97
97
  end
98
98
 
99
- context 'when the fs has a write concern', if: standalone? do
99
+ context 'when the fs has a write concern' do
100
+ require_topology :single
100
101
 
101
102
  let(:fs_options) do
102
103
  { write: INVALID_WRITE_CONCERN }
@@ -87,7 +87,8 @@ describe Mongo::Index::View do
87
87
  view_with_write_concern.drop_one('another_-1')
88
88
  end
89
89
 
90
- context 'when the server accepts writeConcern for the dropIndexes operation', if: collation_enabled? do
90
+ context 'when the server accepts writeConcern for the dropIndexes operation' do
91
+ min_server_fcv '3.4'
91
92
 
92
93
  it 'applies the write concern' do
93
94
  expect {
@@ -96,7 +97,8 @@ describe Mongo::Index::View do
96
97
  end
97
98
  end
98
99
 
99
- context 'when the server does not accept writeConcern for the dropIndexes operation', unless: collation_enabled? do
100
+ context 'when the server does not accept writeConcern for the dropIndexes operation' do
101
+ max_server_version '3.2'
100
102
 
101
103
  it 'does not apply the write concern' do
102
104
  expect(result).to be_successful
@@ -104,7 +106,8 @@ describe Mongo::Index::View do
104
106
  end
105
107
  end
106
108
 
107
- context 'when there are multiple indexes with the same key pattern', if: collation_enabled? do
109
+ context 'when there are multiple indexes with the same key pattern' do
110
+ min_server_fcv '3.4'
108
111
 
109
112
  before do
110
113
  view.create_one({ random: 1 }, unique: true)
@@ -187,7 +190,8 @@ describe Mongo::Index::View do
187
190
  view_with_write_concern.drop_all
188
191
  end
189
192
 
190
- context 'when the server accepts writeConcern for the dropIndexes operation', if: collation_enabled? do
193
+ context 'when the server accepts writeConcern for the dropIndexes operation' do
194
+ min_server_fcv '3.4'
191
195
 
192
196
  it 'applies the write concern' do
193
197
  expect {
@@ -196,7 +200,8 @@ describe Mongo::Index::View do
196
200
  end
197
201
  end
198
202
 
199
- context 'when the server does not accept writeConcern for the dropIndexes operation', unless: collation_enabled? do
203
+ context 'when the server does not accept writeConcern for the dropIndexes operation' do
204
+ max_server_version '3.2'
200
205
 
201
206
  it 'does not apply the write concern' do
202
207
  expect(result).to be_successful
@@ -253,7 +258,8 @@ describe Mongo::Index::View do
253
258
  end
254
259
  end
255
260
 
256
- context 'when collation is specified', if: collation_enabled? do
261
+ context 'when collation is specified' do
262
+ min_server_fcv '3.4'
257
263
 
258
264
  let(:result) do
259
265
  view.create_many(
@@ -267,7 +273,8 @@ describe Mongo::Index::View do
267
273
  view.get('random_1')
268
274
  end
269
275
 
270
- context 'when the server supports collations', if: collation_enabled? do
276
+ context 'when the server supports collations' do
277
+ min_server_fcv '3.4'
271
278
 
272
279
  it 'returns ok' do
273
280
  expect(result).to be_successful
@@ -281,7 +288,8 @@ describe Mongo::Index::View do
281
288
  end
282
289
  end
283
290
 
284
- context 'when the server does not support collations', unless: collation_enabled? do
291
+ context 'when the server does not support collations' do
292
+ max_server_version '3.2'
285
293
 
286
294
  it 'raises an exception' do
287
295
  expect {
@@ -325,7 +333,8 @@ describe Mongo::Index::View do
325
333
  )
326
334
  end
327
335
 
328
- context 'when the server accepts writeConcern for the createIndexes operation', if: collation_enabled? do
336
+ context 'when the server accepts writeConcern for the createIndexes operation' do
337
+ min_server_fcv '3.4'
329
338
 
330
339
  it 'applies the write concern' do
331
340
  expect {
@@ -334,7 +343,8 @@ describe Mongo::Index::View do
334
343
  end
335
344
  end
336
345
 
337
- context 'when the server does not accept writeConcern for the createIndexes operation', unless: collation_enabled? do
346
+ context 'when the server does not accept writeConcern for the createIndexes operation' do
347
+ max_server_version '3.2'
338
348
 
339
349
  it 'does not apply the write concern' do
340
350
  expect(result).to be_successful
@@ -398,7 +408,8 @@ describe Mongo::Index::View do
398
408
  view.get('random_1')
399
409
  end
400
410
 
401
- context 'when the server supports collations', if: collation_enabled? do
411
+ context 'when the server supports collations' do
412
+ min_server_fcv '3.4'
402
413
 
403
414
  it 'returns ok' do
404
415
  expect(result).to be_successful
@@ -412,7 +423,8 @@ describe Mongo::Index::View do
412
423
  end
413
424
  end
414
425
 
415
- context 'when the server does not support collations', unless: collation_enabled? do
426
+ context 'when the server does not support collations' do
427
+ max_server_version '3.2'
416
428
 
417
429
  it 'raises an exception' do
418
430
  expect {
@@ -456,7 +468,8 @@ describe Mongo::Index::View do
456
468
  ])
457
469
  end
458
470
 
459
- context 'when the server accepts writeConcern for the createIndexes operation', if: collation_enabled? do
471
+ context 'when the server accepts writeConcern for the createIndexes operation' do
472
+ min_server_fcv '3.4'
460
473
 
461
474
  it 'applies the write concern' do
462
475
  expect {
@@ -465,7 +478,8 @@ describe Mongo::Index::View do
465
478
  end
466
479
  end
467
480
 
468
- context 'when the server does not accept writeConcern for the createIndexes operation', unless: collation_enabled? do
481
+ context 'when the server does not accept writeConcern for the createIndexes operation' do
482
+ max_server_version '3.2'
469
483
 
470
484
  it 'does not apply the write concern' do
471
485
  expect(result).to be_successful
@@ -545,7 +559,8 @@ describe Mongo::Index::View do
545
559
  view_with_write_concern.create_one(spec, unique: true)
546
560
  end
547
561
 
548
- context 'when the server accepts writeConcern for the createIndexes operation', if: collation_enabled? do
562
+ context 'when the server accepts writeConcern for the createIndexes operation' do
563
+ min_server_fcv '3.4'
549
564
 
550
565
  it 'applies the write concern' do
551
566
  expect {
@@ -554,7 +569,8 @@ describe Mongo::Index::View do
554
569
  end
555
570
  end
556
571
 
557
- context 'when the server does not accept writeConcern for the createIndexes operation', unless: collation_enabled? do
572
+ context 'when the server does not accept writeConcern for the createIndexes operation' do
573
+ max_server_version '3.2'
558
574
 
559
575
  it 'does not apply the write concern' do
560
576
  expect(result).to be_successful
@@ -615,7 +631,7 @@ describe Mongo::Index::View do
615
631
  end
616
632
 
617
633
  context 'when providing an invalid partial index filter' do
618
- min_server_version '3.2'
634
+ min_server_fcv '3.2'
619
635
 
620
636
  it 'raises an exception' do
621
637
  expect {
@@ -625,7 +641,7 @@ describe Mongo::Index::View do
625
641
  end
626
642
 
627
643
  context 'when providing a valid partial index filter' do
628
- min_server_version '3.2'
644
+ min_server_fcv '3.2'
629
645
 
630
646
  let(:expression) do
631
647
  {'a' => {'$lte' => 1.5}}
@@ -732,18 +748,19 @@ describe Mongo::Index::View do
732
748
  end
733
749
 
734
750
  context 'when the collection does not exist' do
751
+ min_server_fcv '3.0'
735
752
 
736
- let(:nonexistant_collection) do
753
+ let(:nonexistent_collection) do
737
754
  authorized_client[:not_a_collection]
738
755
  end
739
756
 
740
- let(:nonexistant_view) do
741
- described_class.new(nonexistant_collection)
757
+ let(:nonexistent_view) do
758
+ described_class.new(nonexistent_collection)
742
759
  end
743
760
 
744
- it 'raises a nonexistant collection error', if: list_command_enabled? do
761
+ it 'raises a nonexistent collection error' do
745
762
  expect {
746
- nonexistant_view.each.to_a
763
+ nonexistent_view.each.to_a
747
764
  }.to raise_error(Mongo::Error::OperationFailure)
748
765
  end
749
766
  end
@@ -809,7 +826,8 @@ describe Mongo::Index::View do
809
826
  end
810
827
  end
811
828
 
812
- context 'when the server supports collations', if: collation_enabled? do
829
+ context 'when the server supports collations' do
830
+ min_server_fcv '3.4'
813
831
 
814
832
  let(:extended_options) do
815
833
  options.merge(:collation => { locale: 'en_US' } )
@@ -113,8 +113,9 @@ describe Mongo::Operation::Delete::OpMsg do
113
113
  authorized_client.start_session
114
114
  end
115
115
 
116
- context 'when the topology is replica set or sharded', if: (replica_set? || sharded?) do
117
- min_server_version '3.6'
116
+ context 'when the topology is replica set or sharded' do
117
+ min_server_fcv '3.6'
118
+ require_topology :replica_set, :sharded
118
119
 
119
120
  let(:expected_global_args) do
120
121
  global_args.merge(Mongo::Operation::CLUSTER_TIME => authorized_client.cluster.cluster_time)
@@ -127,8 +128,9 @@ describe Mongo::Operation::Delete::OpMsg do
127
128
  end
128
129
  end
129
130
 
130
- context 'when the topology is standalone', if: standalone? do
131
- min_server_version '3.6'
131
+ context 'when the topology is standalone' do
132
+ min_server_fcv '3.6'
133
+ require_topology :single
132
134
 
133
135
  let(:expected_global_args) do
134
136
  global_args
@@ -178,7 +180,7 @@ describe Mongo::Operation::Delete::OpMsg do
178
180
  end
179
181
 
180
182
  context 'when the topology is replica set or sharded' do
181
- min_server_version '3.6'
183
+ min_server_fcv '3.6'
182
184
  require_topology :replica_set, :sharded
183
185
 
184
186
  let(:expected_global_args) do
@@ -195,7 +197,9 @@ describe Mongo::Operation::Delete::OpMsg do
195
197
  end
196
198
  end
197
199
 
198
- context 'when the topology is standalone', if: standalone? && sessions_enabled? do
200
+ context 'when the topology is standalone' do
201
+ min_server_fcv '3.6'
202
+ require_topology :single
199
203
 
200
204
  let(:expected_global_args) do
201
205
  global_args.dup.tap do |args|
@@ -212,7 +216,7 @@ describe Mongo::Operation::Delete::OpMsg do
212
216
  end
213
217
 
214
218
  context 'when the session is explicit' do
215
- min_server_version '3.6'
219
+ min_server_fcv '3.6'
216
220
  require_topology :replica_set, :sharded
217
221
 
218
222
  let(:session) do