mongo 2.5.0.beta → 2.5.0
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 +0 -0
- data/lib/mongo/address.rb +1 -1
- data/lib/mongo/address/unix.rb +1 -1
- data/lib/mongo/auth/user.rb +0 -5
- data/lib/mongo/auth/user/view.rb +4 -4
- data/lib/mongo/bulk_write.rb +60 -32
- data/lib/mongo/client.rb +44 -8
- data/lib/mongo/cluster.rb +14 -12
- data/lib/mongo/cluster/periodic_executor.rb +106 -0
- data/lib/mongo/cluster/{cursor_reaper.rb → reapers/cursor_reaper.rb} +5 -37
- data/lib/mongo/cluster/reapers/socket_reaper.rb +59 -0
- data/lib/mongo/collection.rb +9 -6
- data/lib/mongo/collection/view.rb +2 -2
- data/lib/mongo/collection/view/builder/aggregation.rb +2 -1
- data/lib/mongo/collection/view/builder/find_command.rb +1 -1
- data/lib/mongo/collection/view/change_stream.rb +14 -1
- data/lib/mongo/collection/view/map_reduce.rb +30 -13
- data/lib/mongo/collection/view/readable.rb +5 -5
- data/lib/mongo/collection/view/writable.rb +98 -51
- data/lib/mongo/error.rb +3 -0
- data/lib/mongo/error/invalid_txt_record.rb +27 -0
- data/lib/mongo/error/invalid_uri.rb +7 -6
- data/lib/mongo/error/mismatched_domain.rb +27 -0
- data/lib/mongo/error/no_srv_records.rb +26 -0
- data/lib/mongo/error/unsupported_features.rb +0 -18
- data/lib/mongo/index/view.rb +2 -2
- data/lib/mongo/operation.rb +1 -0
- data/lib/mongo/operation/causally_consistent.rb +33 -0
- data/lib/mongo/operation/commands.rb +2 -1
- data/lib/mongo/operation/commands/aggregate.rb +2 -7
- data/lib/mongo/operation/commands/count.rb +27 -0
- data/lib/mongo/operation/commands/distinct.rb +27 -0
- data/lib/mongo/operation/commands/find.rb +3 -1
- data/lib/mongo/operation/commands/map_reduce.rb +1 -0
- data/lib/mongo/operation/commands/parallel_scan.rb +1 -0
- data/lib/mongo/operation/specifiable.rb +12 -0
- data/lib/mongo/operation/uses_command_op_msg.rb +36 -5
- data/lib/mongo/operation/write.rb +0 -5
- data/lib/mongo/operation/write/bulk/bulkable.rb +4 -8
- data/lib/mongo/operation/write/bulk/mergable.rb +2 -0
- data/lib/mongo/operation/write/command/create_index.rb +19 -0
- data/lib/mongo/operation/write/command/create_user.rb +19 -0
- data/lib/mongo/operation/write/command/delete.rb +1 -2
- data/lib/mongo/operation/write/command/drop_index.rb +19 -0
- data/lib/mongo/operation/write/command/insert.rb +1 -2
- data/lib/mongo/operation/write/command/remove_user.rb +19 -0
- data/lib/mongo/operation/write/command/update.rb +1 -2
- data/lib/mongo/operation/write/command/update_user.rb +19 -0
- data/lib/mongo/operation/write/write_command_enabled.rb +1 -3
- data/lib/mongo/protocol/compressed.rb +2 -1
- data/lib/mongo/protocol/serializers.rb +6 -6
- data/lib/mongo/retryable.rb +48 -5
- data/lib/mongo/server.rb +15 -0
- data/lib/mongo/server/connection.rb +21 -1
- data/lib/mongo/server/connection_pool.rb +3 -0
- data/lib/mongo/server/connection_pool/queue.rb +50 -5
- data/lib/mongo/server/description.rb +11 -3
- data/lib/mongo/server/description/features.rb +26 -7
- data/lib/mongo/session.rb +133 -6
- data/lib/mongo/session/server_session.rb +30 -0
- data/lib/mongo/session/session_pool.rb +20 -20
- data/lib/mongo/uri.rb +88 -44
- data/lib/mongo/uri/srv_protocol.rb +158 -0
- data/lib/mongo/version.rb +1 -1
- data/lib/mongo/write_concern/normalizable.rb +12 -0
- data/mongo.gemspec +1 -2
- data/spec/mongo/address_spec.rb +12 -0
- data/spec/mongo/auth/user/view_spec.rb +1 -5
- data/spec/mongo/bulk_write_spec.rb +232 -401
- data/spec/mongo/change_stream_examples_spec.rb +150 -0
- data/spec/mongo/client_spec.rb +142 -2
- data/spec/mongo/cluster/cursor_reaper_spec.rb +0 -70
- data/spec/mongo/cluster/socket_reaper_spec.rb +32 -0
- data/spec/mongo/cluster_spec.rb +11 -7
- data/spec/mongo/collection/view/aggregation_spec.rb +46 -1
- data/spec/mongo/collection/view/builder/find_command_spec.rb +15 -0
- data/spec/mongo/collection/view/change_stream_spec.rb +79 -12
- data/spec/mongo/collection/view/map_reduce_spec.rb +120 -4
- data/spec/mongo/collection/view/readable_spec.rb +23 -5
- data/spec/mongo/collection_spec.rb +292 -102
- data/spec/mongo/command_monitoring_spec.rb +26 -32
- data/spec/mongo/crud_spec.rb +1 -1
- data/spec/mongo/cursor_spec.rb +2 -3
- data/spec/mongo/database_spec.rb +30 -14
- data/spec/mongo/dns_seedlist_discovery_spec.rb +94 -0
- data/spec/mongo/grid/fs_bucket_spec.rb +1 -1
- data/spec/mongo/grid/stream/write_spec.rb +1 -1
- data/spec/mongo/index/view_spec.rb +8 -46
- data/spec/mongo/operation/write/bulk/delete_spec.rb +2 -2
- data/spec/mongo/operation/write/bulk/insert_spec.rb +2 -10
- data/spec/mongo/operation/write/{create_index_spec.rb → command/create_index_spec.rb} +2 -6
- data/spec/mongo/operation/write/command/delete_spec.rb +35 -7
- data/spec/mongo/operation/write/{drop_index_spec.rb → command/drop_index_spec.rb} +1 -1
- data/spec/mongo/operation/write/command/insert_spec.rb +37 -6
- data/spec/mongo/operation/write/{remove_user_spec.rb → command/remove_user_spec.rb} +2 -6
- data/spec/mongo/operation/write/command/update_spec.rb +34 -7
- data/spec/mongo/operation/write/{update_user_spec.rb → command/update_user_spec.rb} +1 -1
- data/spec/mongo/operation/write/create_user_spec.rb +1 -1
- data/spec/mongo/operation/write/delete_spec.rb +1 -1
- data/spec/mongo/operation/write/insert_spec.rb +2 -10
- data/spec/mongo/operation/write/update_spec.rb +3 -15
- data/spec/mongo/retryable_spec.rb +1 -1
- data/spec/mongo/retryable_writes_spec.rb +815 -0
- data/spec/mongo/server/connection_pool/queue_spec.rb +35 -2
- data/spec/mongo/server/connection_pool_spec.rb +234 -1
- data/spec/mongo/server/connection_spec.rb +10 -6
- data/spec/mongo/server/description/features_spec.rb +51 -37
- data/spec/mongo/server/description_spec.rb +6 -3
- data/spec/mongo/server_spec.rb +87 -0
- data/spec/mongo/session/server_session_spec.rb +43 -0
- data/spec/mongo/session/session_pool_spec.rb +63 -27
- data/spec/mongo/session_spec.rb +247 -0
- data/spec/mongo/shell_examples_spec.rb +2 -2
- data/spec/mongo/uri/srv_protocol_spec.rb +933 -0
- data/spec/mongo/uri_spec.rb +42 -3
- data/spec/mongo/write_concern/acknowledged_spec.rb +11 -0
- data/spec/mongo/write_concern/unacknowledged_spec.rb +11 -0
- data/spec/spec_helper.rb +11 -25
- data/spec/support/authorization.rb +2 -1
- data/spec/support/connection_string.rb +8 -4
- data/spec/support/crud.rb +38 -24
- data/spec/support/crud/write.rb +30 -3
- data/spec/support/crud_tests/read/aggregate-out.yml +21 -0
- data/spec/support/crud_tests/write/bulkWrite-arrayFilters.yml +44 -0
- data/spec/support/crud_tests/write/findOneAndUpdate-arrayFilters.yml +1 -1
- data/spec/support/crud_tests/write/insertMany.yml +1 -3
- data/spec/support/crud_tests/write/replaceOne.yml +1 -1
- data/spec/support/crud_tests/write/updateMany-arrayFilters.yml +1 -1
- data/spec/support/crud_tests/write/updateOne-arrayFilters.yml +1 -1
- data/spec/support/dns_seedlist_discovery_tests/longer-parent-in-return.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/misformatted-option.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/no-results.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/not-enough-parts.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/one-result-default-port.yml +10 -0
- data/spec/support/dns_seedlist_discovery_tests/one-txt-record-multiple-strings.yml +10 -0
- data/spec/support/dns_seedlist_discovery_tests/one-txt-record.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch1.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch2.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch3.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch4.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch5.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/returned-parent-too-short.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/returned-parent-wrong.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/two-results-default-port.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/two-results-nonstandard-port.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/two-txt-records.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/txt-record-not-allowed-option.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/txt-record-with-overridden-ssl-option.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/txt-record-with-overridden-uri-option.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/txt-record-with-unallowed-option.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/uri-with-port.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/uri-with-two-hosts.yml +5 -0
- data/spec/support/retryable_writes_tests/bulkWrite.yml +305 -0
- data/spec/support/retryable_writes_tests/deleteOne.yml +51 -0
- data/spec/support/retryable_writes_tests/findOneAndDelete.yml +52 -0
- data/spec/support/retryable_writes_tests/findOneAndReplace.yml +57 -0
- data/spec/support/retryable_writes_tests/findOneAndUpdate.yml +56 -0
- data/spec/support/retryable_writes_tests/insertMany.yml +72 -0
- data/spec/support/retryable_writes_tests/insertOne.yml +55 -0
- data/spec/support/retryable_writes_tests/replaceOne.yml +60 -0
- data/spec/support/retryable_writes_tests/updateOne.yml +120 -0
- data/spec/support/shared/session.rb +525 -24
- metadata +437 -350
- metadata.gz.sig +0 -0
- data/lib/mongo/operation/commands/user_query.rb +0 -72
- data/lib/mongo/operation/write/create_index.rb +0 -67
- data/lib/mongo/operation/write/create_user.rb +0 -50
- data/lib/mongo/operation/write/drop_index.rb +0 -63
- data/lib/mongo/operation/write/remove_user.rb +0 -48
- data/lib/mongo/operation/write/update_user.rb +0 -50
@@ -1,9 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
def skippable?(file)
|
4
|
-
!write_command_enabled? && (file.include?('bulkWrite') || file.include?('insert'))
|
5
|
-
end
|
6
|
-
|
7
3
|
def ignore?(test)
|
8
4
|
if version = test.ignore_if_server_version_greater_than
|
9
5
|
return true if version == "3.0" && find_command_enabled?
|
@@ -18,43 +14,41 @@ describe 'Command Monitoring Events' do
|
|
18
14
|
|
19
15
|
COMMAND_MONITORING_TESTS.each do |file|
|
20
16
|
|
21
|
-
if !skippable?(file)
|
22
17
|
|
23
|
-
|
18
|
+
spec = Mongo::CommandMonitoring::Spec.new(file)
|
24
19
|
|
25
|
-
|
20
|
+
spec.tests.each do |test|
|
26
21
|
|
27
|
-
|
22
|
+
context(test.description) do
|
28
23
|
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
let(:subscriber) do
|
25
|
+
Mongo::CommandMonitoring::TestSubscriber.new
|
26
|
+
end
|
32
27
|
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
let(:monitoring) do
|
29
|
+
authorized_client.instance_variable_get(:@monitoring)
|
30
|
+
end
|
36
31
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
before do
|
33
|
+
authorized_collection.find.delete_many
|
34
|
+
authorized_client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
|
35
|
+
end
|
41
36
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
after do
|
38
|
+
monitoring.subscribers[Mongo::Monitoring::COMMAND].delete(subscriber)
|
39
|
+
authorized_collection.find.delete_many
|
40
|
+
end
|
46
41
|
|
47
|
-
|
42
|
+
test.expectations.each do |expectation|
|
48
43
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
44
|
+
it "generates a #{expectation.event_name} for #{expectation.command_name}", unless: ignore?(test) do
|
45
|
+
begin
|
46
|
+
test.run(authorized_collection)
|
47
|
+
event = subscriber.send(expectation.event_type)[expectation.command_name]
|
48
|
+
expect(event).to send(expectation.matcher, expectation)
|
49
|
+
rescue Mongo::Error::OperationFailure, Mongo::Error::BulkWriteError
|
50
|
+
event = subscriber.send(expectation.event_type)[expectation.command_name]
|
51
|
+
expect(event).to send(expectation.matcher, expectation)
|
58
52
|
end
|
59
53
|
end
|
60
54
|
end
|
data/spec/mongo/crud_spec.rb
CHANGED
data/spec/mongo/cursor_spec.rb
CHANGED
@@ -267,9 +267,8 @@ describe Mongo::Cursor do
|
|
267
267
|
authorized_client.cluster.instance_variable_get(:@cursor_reaper)
|
268
268
|
end
|
269
269
|
|
270
|
-
|
271
|
-
|
272
|
-
sleep(Mongo::Cluster::CursorReaper::FREQUENCY + 0.5)
|
270
|
+
it 'schedules a kill cursors op', unless: sessions_enabled? do
|
271
|
+
sleep(Mongo::Cluster::PeriodicExecutor::FREQUENCY)
|
273
272
|
expect {
|
274
273
|
cursor.to_a
|
275
274
|
}.to raise_exception(Mongo::Error::OperationFailure)
|
data/spec/mongo/database_spec.rb
CHANGED
@@ -208,7 +208,7 @@ describe Mongo::Database do
|
|
208
208
|
described_class.new(authorized_client, 'invalid_database')
|
209
209
|
end
|
210
210
|
|
211
|
-
it 'returns an empty list'
|
211
|
+
it 'returns an empty list' do
|
212
212
|
expect(database.collections).to be_empty
|
213
213
|
end
|
214
214
|
end
|
@@ -241,22 +241,44 @@ describe Mongo::Database do
|
|
241
241
|
expect(database.command({:ismaster => 1}.freeze).written_count).to eq(0)
|
242
242
|
end
|
243
243
|
|
244
|
-
context 'when provided a session' do
|
244
|
+
context 'when provided a session', if: sessions_enabled? do
|
245
245
|
|
246
246
|
let(:operation) do
|
247
|
-
database.command({ :ismaster => 1 }, session: session)
|
247
|
+
client.database.command({ :ismaster => 1 }, session: session)
|
248
248
|
end
|
249
249
|
|
250
250
|
let(:failed_operation) do
|
251
|
-
database.command({ :invalid => 1 }, session: session)
|
251
|
+
client.database.command({ :invalid => 1 }, session: session)
|
252
|
+
end
|
253
|
+
|
254
|
+
let(:session) do
|
255
|
+
client.start_session
|
252
256
|
end
|
253
257
|
|
254
258
|
let(:client) do
|
255
|
-
authorized_client
|
259
|
+
authorized_client.with(heartbeat_frequency: 100).tap do |cl|
|
260
|
+
cl.subscribe(Mongo::Monitoring::COMMAND, subscriber)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
let(:subscriber) do
|
265
|
+
EventSubscriber.new
|
256
266
|
end
|
257
267
|
|
258
268
|
it_behaves_like 'an operation using a session'
|
259
269
|
it_behaves_like 'a failed operation using a session'
|
270
|
+
|
271
|
+
|
272
|
+
let(:full_command) do
|
273
|
+
subscriber.started_events.find { |cmd| cmd.command_name == :ismaster }.command
|
274
|
+
end
|
275
|
+
|
276
|
+
it 'does not add a afterClusterTime field' do
|
277
|
+
# Ensure that the session has an operation time
|
278
|
+
client.database.command({ ping: 1 }, session: session)
|
279
|
+
operation
|
280
|
+
expect(full_command['readConcern']).to be_nil
|
281
|
+
end
|
260
282
|
end
|
261
283
|
|
262
284
|
context 'when a read concern is provided', if: find_command_enabled? do
|
@@ -396,7 +418,7 @@ describe Mongo::Database do
|
|
396
418
|
described_class.new(authorized_client.with(client_options), TEST_DB)
|
397
419
|
end
|
398
420
|
|
399
|
-
context 'when a write concern is not in the command selector'
|
421
|
+
context 'when a write concern is not in the command selector' do
|
400
422
|
|
401
423
|
let(:cmd) do
|
402
424
|
{
|
@@ -410,7 +432,7 @@ describe Mongo::Database do
|
|
410
432
|
end
|
411
433
|
end
|
412
434
|
|
413
|
-
context 'when a write concern is provided in the command selector', if:
|
435
|
+
context 'when a write concern is provided in the command selector', if: standalone? do
|
414
436
|
|
415
437
|
let(:cmd) do
|
416
438
|
{
|
@@ -435,16 +457,10 @@ describe Mongo::Database do
|
|
435
457
|
described_class.new(authorized_client, TEST_DB)
|
436
458
|
end
|
437
459
|
|
438
|
-
it 'drops the database'
|
460
|
+
it 'drops the database' do
|
439
461
|
expect(database.drop).to be_successful
|
440
462
|
end
|
441
463
|
|
442
|
-
it 'raises an exception', if: (!write_command_enabled? && auth_enabled?) do
|
443
|
-
expect {
|
444
|
-
database.drop
|
445
|
-
}.to raise_error(Mongo::Error::OperationFailure)
|
446
|
-
end
|
447
|
-
|
448
464
|
context 'when provided a session' do
|
449
465
|
|
450
466
|
let(:operation) do
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'DNS Seedlist Discovery' do
|
4
|
+
include Mongo::ConnectionString
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
|
8
|
+
module Mongo
|
9
|
+
class Server
|
10
|
+
# The constructor keeps the same API, but does not instantiate a
|
11
|
+
# monitor and run it.
|
12
|
+
alias :original_initialize :initialize
|
13
|
+
|
14
|
+
def initialize(address, cluster, monitoring, event_listeners, options = {})
|
15
|
+
@address = address
|
16
|
+
@cluster = cluster
|
17
|
+
@monitoring = monitoring
|
18
|
+
@options = options.freeze
|
19
|
+
@monitor = Monitor.new(address, event_listeners, options)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Disconnect simply needs to return true since we have no monitor and
|
23
|
+
# no connection.
|
24
|
+
alias :original_disconnect! :disconnect!
|
25
|
+
|
26
|
+
def disconnect!;
|
27
|
+
true;
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
after(:all) do
|
34
|
+
|
35
|
+
module Mongo
|
36
|
+
class Server
|
37
|
+
alias :initialize :original_initialize
|
38
|
+
remove_method(:original_initialize)
|
39
|
+
|
40
|
+
alias :disconnect! :original_disconnect!
|
41
|
+
remove_method(:original_disconnect!)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
DNS_SEEDLIST_DISCOVERY_TESTS.each do |file_name|
|
47
|
+
|
48
|
+
file = File.new(file_name)
|
49
|
+
spec = YAML.load(ERB.new(file.read).result)
|
50
|
+
file.close
|
51
|
+
|
52
|
+
test = Mongo::ConnectionString::Test.new(spec)
|
53
|
+
|
54
|
+
context(File.basename(file_name)) do
|
55
|
+
|
56
|
+
context 'when the uri is invalid', if: test.raise_error? do
|
57
|
+
|
58
|
+
let(:valid_errors) do
|
59
|
+
[
|
60
|
+
Mongo::Error::InvalidTXTRecord,
|
61
|
+
Mongo::Error::NoSRVRecords,
|
62
|
+
Mongo::Error::InvalidURI,
|
63
|
+
Mongo::Error::MismatchedDomain,
|
64
|
+
]
|
65
|
+
end
|
66
|
+
|
67
|
+
let(:error) do
|
68
|
+
e = nil
|
69
|
+
begin; test.uri; rescue => ex; e = ex; end
|
70
|
+
e
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'raises an error' do
|
74
|
+
expect(valid_errors).to include(error.class)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'when the uri is valid', unless: test.raise_error? do
|
79
|
+
|
80
|
+
it 'does not raise an exception' do
|
81
|
+
expect(test.uri).to be_a(Mongo::URI::SRVProtocol)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'creates a client with the correct hosts' do
|
85
|
+
expect(test.client).to have_hosts(test)
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'creates a client with the correct options' do
|
89
|
+
expect(test.client).to match_options(test)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -275,7 +275,7 @@ describe Mongo::Grid::FSBucket::Stream::Write do
|
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
278
|
-
context 'when the index creation encounters an error'
|
278
|
+
context 'when the index creation encounters an error' do
|
279
279
|
|
280
280
|
before do
|
281
281
|
fs.chunks_collection.drop
|
@@ -347,18 +347,8 @@ describe Mongo::Index::View do
|
|
347
347
|
|
348
348
|
context 'when the server does not accept writeConcern for the createIndexes operation', unless: collation_enabled? do
|
349
349
|
|
350
|
-
|
351
|
-
|
352
|
-
it 'does not apply the write concern' do
|
353
|
-
expect(result).to be_successful
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
|
-
context 'when the driver inserts into the system.indexes collection', unless: write_command_enabled? do
|
358
|
-
|
359
|
-
it 'does not apply the write concern' do
|
360
|
-
expect(result).to be_successful
|
361
|
-
end
|
350
|
+
it 'does not apply the write concern' do
|
351
|
+
expect(result).to be_successful
|
362
352
|
end
|
363
353
|
end
|
364
354
|
end
|
@@ -502,18 +492,8 @@ describe Mongo::Index::View do
|
|
502
492
|
|
503
493
|
context 'when the server does not accept writeConcern for the createIndexes operation', unless: collation_enabled? do
|
504
494
|
|
505
|
-
|
506
|
-
|
507
|
-
it 'does not apply the write concern' do
|
508
|
-
expect(result).to be_successful
|
509
|
-
end
|
510
|
-
end
|
511
|
-
|
512
|
-
context 'when the driver inserts into the system.indexes collection', unless: write_command_enabled? do
|
513
|
-
|
514
|
-
it 'does not apply the write concern' do
|
515
|
-
expect(result).to be_successful
|
516
|
-
end
|
495
|
+
it 'does not apply the write concern' do
|
496
|
+
expect(result).to be_successful
|
517
497
|
end
|
518
498
|
end
|
519
499
|
end
|
@@ -533,15 +513,11 @@ describe Mongo::Index::View do
|
|
533
513
|
view.drop_one('name_1')
|
534
514
|
end
|
535
515
|
|
536
|
-
it 'raises an exception'
|
516
|
+
it 'raises an exception' do
|
537
517
|
expect {
|
538
518
|
view.create_many([{ key: { name: 1 }, unique: false }])
|
539
519
|
}.to raise_error(Mongo::Error::OperationFailure)
|
540
520
|
end
|
541
|
-
|
542
|
-
it 'does not raise an exception', unless: write_command_enabled? do
|
543
|
-
expect(view.create_many([{ key: { name: 1 }, unique: false }])).to be_successful
|
544
|
-
end
|
545
521
|
end
|
546
522
|
end
|
547
523
|
end
|
@@ -613,18 +589,8 @@ describe Mongo::Index::View do
|
|
613
589
|
|
614
590
|
context 'when the server does not accept writeConcern for the createIndexes operation', unless: collation_enabled? do
|
615
591
|
|
616
|
-
|
617
|
-
|
618
|
-
it 'does not apply the write concern' do
|
619
|
-
expect(result).to be_successful
|
620
|
-
end
|
621
|
-
end
|
622
|
-
|
623
|
-
context 'when the driver inserts into the system.indexes collection', unless: write_command_enabled? do
|
624
|
-
|
625
|
-
it 'does not apply the write concern' do
|
626
|
-
expect(result).to be_successful
|
627
|
-
end
|
592
|
+
it 'does not apply the write concern' do
|
593
|
+
expect(result).to be_successful
|
628
594
|
end
|
629
595
|
end
|
630
596
|
end
|
@@ -667,15 +633,11 @@ describe Mongo::Index::View do
|
|
667
633
|
view.drop_one('name_1')
|
668
634
|
end
|
669
635
|
|
670
|
-
it 'raises an exception'
|
636
|
+
it 'raises an exception' do
|
671
637
|
expect {
|
672
638
|
view.create_one(spec, unique: false)
|
673
639
|
}.to raise_error(Mongo::Error::OperationFailure)
|
674
640
|
end
|
675
|
-
|
676
|
-
it 'does not raise an exception', unless: write_command_enabled? do
|
677
|
-
expect(view.create_one(spec, unique: false)).to be_successful
|
678
|
-
end
|
679
641
|
end
|
680
642
|
|
681
643
|
context 'when providing an index name' do
|
@@ -125,7 +125,7 @@ describe Mongo::Operation::Write::Bulk::Delete do
|
|
125
125
|
context 'when the deletes are ordered' do
|
126
126
|
|
127
127
|
let(:documents) do
|
128
|
-
[
|
128
|
+
[ { q: { '$set' => { a: 1 } }, limit: 0 },
|
129
129
|
{ 'q' => { field: 'test' }, 'limit' => 1 }
|
130
130
|
]
|
131
131
|
end
|
@@ -174,7 +174,7 @@ describe Mongo::Operation::Write::Bulk::Delete do
|
|
174
174
|
context 'when the deletes are unordered' do
|
175
175
|
|
176
176
|
let(:documents) do
|
177
|
-
[
|
177
|
+
[ { q: { '$set' => { a: 1 } }, limit: 0 },
|
178
178
|
{ 'q' => { field: 'test' }, 'limit' => 1 }
|
179
179
|
]
|
180
180
|
end
|
@@ -119,13 +119,9 @@ describe Mongo::Operation::Write::Bulk::Insert do
|
|
119
119
|
op.execute(authorized_primary)
|
120
120
|
end
|
121
121
|
|
122
|
-
it 'inserts the documents into the database'
|
122
|
+
it 'inserts the documents into the database' do
|
123
123
|
expect(response.written_count).to eq(1)
|
124
124
|
end
|
125
|
-
|
126
|
-
it 'inserts the documents into the database', unless: write_command_enabled? do
|
127
|
-
expect(response.written_count).to eq(0)
|
128
|
-
end
|
129
125
|
end
|
130
126
|
end
|
131
127
|
|
@@ -141,13 +137,9 @@ describe Mongo::Operation::Write::Bulk::Insert do
|
|
141
137
|
op.execute(authorized_primary)
|
142
138
|
end
|
143
139
|
|
144
|
-
it 'inserts the documents into the database'
|
140
|
+
it 'inserts the documents into the database' do
|
145
141
|
expect(response.written_count).to eq(2)
|
146
142
|
end
|
147
|
-
|
148
|
-
it 'inserts the documents into the database', unless: write_command_enabled? do
|
149
|
-
expect(response.written_count).to eq(0)
|
150
|
-
end
|
151
143
|
end
|
152
144
|
end
|
153
145
|
|