mongo 2.4.0 → 2.4.1
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/collection.rb +7 -7
- data/lib/mongo/collection/view.rb +9 -2
- data/lib/mongo/collection/view/aggregation.rb +2 -2
- data/lib/mongo/collection/view/builder/map_reduce.rb +11 -3
- data/lib/mongo/collection/view/iterable.rb +1 -1
- data/lib/mongo/collection/view/map_reduce.rb +2 -2
- data/lib/mongo/collection/view/readable.rb +27 -25
- data/lib/mongo/collection/view/writable.rb +15 -23
- data/lib/mongo/index/view.rb +2 -1
- data/lib/mongo/uri.rb +5 -4
- data/lib/mongo/version.rb +1 -1
- data/mongo.gemspec +1 -1
- data/spec/mongo/collection/view/aggregation_spec.rb +25 -7
- data/spec/mongo/collection/view/map_reduce_spec.rb +111 -13
- data/spec/mongo/collection/view/readable_spec.rb +207 -1
- data/spec/mongo/collection/view/writable_spec.rb +398 -5
- data/spec/mongo/collection_spec.rb +48 -39
- data/spec/mongo/sdam_spec.rb +17 -10
- data/spec/mongo/uri_spec.rb +25 -0
- data/spec/spec_helper.rb +5 -1
- data/spec/support/sdam/rs/primary_mismatched_me.yml +2 -2
- data/spec/support/sdam/rs/secondary_mismatched_me.yml +2 -2
- metadata +20 -14
- metadata.gz.sig +0 -0
@@ -538,62 +538,71 @@ describe Mongo::Collection do
|
|
538
538
|
described_class.new(database, :specs)
|
539
539
|
end
|
540
540
|
|
541
|
-
|
542
|
-
|
543
|
-
|
541
|
+
context 'when the collection exists' do
|
542
|
+
before do
|
543
|
+
collection.create
|
544
|
+
end
|
544
545
|
|
545
|
-
|
546
|
+
context 'when the collection does not have a write concern set' do
|
546
547
|
|
547
|
-
|
548
|
-
|
549
|
-
|
548
|
+
let!(:response) do
|
549
|
+
collection.drop
|
550
|
+
end
|
550
551
|
|
551
|
-
|
552
|
-
|
553
|
-
|
552
|
+
it 'executes the command' do
|
553
|
+
expect(response).to be_successful
|
554
|
+
end
|
554
555
|
|
555
|
-
|
556
|
-
|
557
|
-
|
556
|
+
it 'drops the collection from the database' do
|
557
|
+
expect(database.collection_names).to_not include('specs')
|
558
|
+
end
|
558
559
|
|
559
|
-
|
560
|
+
context 'when the collection does not exist' do
|
560
561
|
|
561
|
-
|
562
|
-
|
562
|
+
it 'does not raise an error' do
|
563
|
+
expect(database['non-existent-coll'].drop).to be(false)
|
564
|
+
end
|
563
565
|
end
|
564
566
|
end
|
565
|
-
end
|
566
567
|
|
567
|
-
|
568
|
+
context 'when the collection has a write concern' do
|
568
569
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
570
|
+
let(:write_options) do
|
571
|
+
{
|
572
|
+
write: { w: WRITE_CONCERN[:w] + 1}
|
573
|
+
}
|
574
|
+
end
|
574
575
|
|
575
|
-
|
576
|
-
|
577
|
-
|
576
|
+
let(:collection_with_write_options) do
|
577
|
+
collection.with(write_options)
|
578
|
+
end
|
578
579
|
|
579
|
-
|
580
|
-
|
581
|
-
|
580
|
+
after do
|
581
|
+
collection.drop
|
582
|
+
end
|
583
|
+
|
584
|
+
context 'when the server supports write concern on the drop command', if: collation_enabled? do
|
582
585
|
|
583
|
-
|
586
|
+
it 'applies the write concern' do
|
587
|
+
expect{
|
588
|
+
collection_with_write_options.drop
|
589
|
+
}.to raise_exception(Mongo::Error::OperationFailure)
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
context 'when the server does not support write concern on the drop command', unless: collation_enabled? do
|
584
594
|
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
}.to raise_exception(Mongo::Error::OperationFailure)
|
595
|
+
it 'does not apply the write concern' do
|
596
|
+
expect(collection_with_write_options.drop).to be_successful
|
597
|
+
end
|
589
598
|
end
|
590
599
|
end
|
600
|
+
end
|
591
601
|
|
592
|
-
|
602
|
+
context 'when the collection does not exist' do
|
593
603
|
|
594
|
-
|
595
|
-
|
596
|
-
end
|
604
|
+
it 'returns false' do
|
605
|
+
expect(collection.drop).to be(false)
|
597
606
|
end
|
598
607
|
end
|
599
608
|
end
|
@@ -1158,7 +1167,7 @@ describe Mongo::Collection do
|
|
1158
1167
|
end
|
1159
1168
|
|
1160
1169
|
it 'sets the options on the Aggregation object' do
|
1161
|
-
expect(authorized_collection.aggregate([], options).options).to eq(options)
|
1170
|
+
expect(authorized_collection.aggregate([], options).options).to eq(BSON::Document.new(options))
|
1162
1171
|
end
|
1163
1172
|
|
1164
1173
|
context 'when collation is provided' do
|
data/spec/mongo/sdam_spec.rb
CHANGED
@@ -10,9 +10,12 @@ describe 'Server Discovery and Monitoring' do
|
|
10
10
|
context(spec.description) do
|
11
11
|
|
12
12
|
before(:all) do
|
13
|
-
Mongo::Client.new(
|
14
|
-
|
15
|
-
|
13
|
+
@client = Mongo::Client.new([])
|
14
|
+
@client.send(:create_from_uri, spec.uri_string)
|
15
|
+
client_options = @client.instance_variable_get(:@options)
|
16
|
+
@client.instance_variable_set(:@options, client_options.merge(heartbeat_frequency: 100, connect_timeout: 0.1))
|
17
|
+
@client.cluster.instance_variable_set(:@options, client_options.merge(heartbeat_frequency: 100, connect_timeout: 0.1))
|
18
|
+
@client.cluster.instance_variable_get(:@servers).each { |s| s.disconnect!; s.unknown!; }
|
16
19
|
end
|
17
20
|
|
18
21
|
after(:all) do
|
@@ -26,13 +29,17 @@ describe 'Server Discovery and Monitoring' do
|
|
26
29
|
before(:all) do
|
27
30
|
phase.responses.each do |response|
|
28
31
|
server = find_server(@client, response.address)
|
29
|
-
server
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
unless server
|
33
|
+
server = Mongo::Server.new(
|
34
|
+
Mongo::Address.new(response.address),
|
35
|
+
@client.cluster,
|
36
|
+
@client.instance_variable_get(:@monitoring),
|
37
|
+
@client.cluster.send(:event_listeners),
|
38
|
+
@client.cluster.options
|
39
|
+
)
|
40
|
+
server.disconnect!
|
41
|
+
server.unknown!
|
42
|
+
end
|
36
43
|
monitor = server.instance_variable_get(:@monitor)
|
37
44
|
description = monitor.inspector.run(server.description, response.ismaster, 0.5)
|
38
45
|
monitor.instance_variable_set(:@description, description)
|
data/spec/mongo/uri_spec.rb
CHANGED
@@ -667,6 +667,31 @@ describe Mongo::URI do
|
|
667
667
|
expect(Mongo::Client.new(string.downcase).options[:auth_mech]).to eq(expected)
|
668
668
|
end
|
669
669
|
end
|
670
|
+
|
671
|
+
context 'mongodb-x509' do
|
672
|
+
let(:mechanism) { 'MONGODB-X509' }
|
673
|
+
let(:expected) { :mongodb_x509 }
|
674
|
+
|
675
|
+
it 'sets the auth mechanism to :mongodb_x509' do
|
676
|
+
expect(uri.uri_options[:auth_mech]).to eq(expected)
|
677
|
+
end
|
678
|
+
|
679
|
+
it 'sets the options on a client created with the uri' do
|
680
|
+
expect(Mongo::Client.new(string).options[:auth_mech]).to eq(expected)
|
681
|
+
end
|
682
|
+
|
683
|
+
it 'is case-insensitive' do
|
684
|
+
expect(Mongo::Client.new(string.downcase).options[:auth_mech]).to eq(expected)
|
685
|
+
end
|
686
|
+
|
687
|
+
context 'when a username is not provided' do
|
688
|
+
|
689
|
+
it 'recognizes the mechanism with no username' do
|
690
|
+
expect(Mongo::Client.new(string.downcase).options[:auth_mech]).to eq(expected)
|
691
|
+
expect(Mongo::Client.new(string.downcase).options[:user]).to be_nil
|
692
|
+
end
|
693
|
+
end
|
694
|
+
end
|
670
695
|
end
|
671
696
|
|
672
697
|
context 'auth source provided' do
|
data/spec/spec_helper.rb
CHANGED
@@ -192,7 +192,11 @@ end
|
|
192
192
|
# @since 2.2.0
|
193
193
|
def auth_enabled?
|
194
194
|
$mongo_client ||= initialize_scanned_client!
|
195
|
-
begin
|
195
|
+
begin
|
196
|
+
$mongo_client.use(:admin).command(getCmdLineOpts: 1).first["argv"].include?("--auth")
|
197
|
+
rescue
|
198
|
+
return true
|
199
|
+
end
|
196
200
|
false
|
197
201
|
end
|
198
202
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
},
|
19
19
|
"responses": [
|
20
20
|
[
|
21
|
-
"
|
21
|
+
"localhost:27017",
|
22
22
|
{
|
23
23
|
"me": "a:27017",
|
24
24
|
"hosts": [
|
@@ -33,5 +33,5 @@
|
|
33
33
|
]
|
34
34
|
}
|
35
35
|
],
|
36
|
-
"uri": "mongodb://
|
36
|
+
"uri": "mongodb://localhost:27017/?replicaSet=rs"
|
37
37
|
}
|
@@ -18,7 +18,7 @@
|
|
18
18
|
},
|
19
19
|
"responses": [
|
20
20
|
[
|
21
|
-
"
|
21
|
+
"localhost:27017",
|
22
22
|
{
|
23
23
|
"me": "a:27017",
|
24
24
|
"hosts": [
|
@@ -33,5 +33,5 @@
|
|
33
33
|
]
|
34
34
|
}
|
35
35
|
],
|
36
|
-
"uri": "mongodb://
|
36
|
+
"uri": "mongodb://localhost:27017/?replicaSet=rs"
|
37
37
|
}
|
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.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -14,7 +14,7 @@ cert_chain:
|
|
14
14
|
-----BEGIN CERTIFICATE-----
|
15
15
|
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtkcml2
|
16
16
|
ZXItcnVieTEVMBMGCgmSJomT8ixkARkWBTEwZ2VuMRMwEQYKCZImiZPyLGQBGRYD
|
17
|
-
|
17
|
+
Y29tMB4XDTE2MTIyMDEzMzc1N1oXDTE3MTIyMDEzMzc1N1owQjEUMBIGA1UEAwwL
|
18
18
|
ZHJpdmVyLXJ1YnkxFTATBgoJkiaJk/IsZAEZFgUxMGdlbjETMBEGCgmSJomT8ixk
|
19
19
|
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANFdSAa8fRm1
|
20
20
|
bAM9za6Z0fAH4g02bqM1NGnw8zJQrE/PFrFfY6IFCT2AsLfOwr1maVm7iU1+kdVI
|
@@ -25,29 +25,35 @@ cert_chain:
|
|
25
25
|
u8KAcPHm5KkCAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
26
26
|
BBYEFFt3WbF+9JpUjAoj62cQBgNb8HzXMCAGA1UdEQQZMBeBFWRyaXZlci1ydWJ5
|
27
27
|
QDEwZ2VuLmNvbTAgBgNVHRIEGTAXgRVkcml2ZXItcnVieUAxMGdlbi5jb20wDQYJ
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
KoZIhvcNAQEFBQADggEBABls+be8yTD61iZd+lMwdTu5hx9xVWiNssI/MuNfuZzo
|
29
|
+
W7g7AUDrMXELJN9NwNFSFJw4vsAlfzl5sB2G3oCLef93vH4NwrTV4v5FIAk7mq8t
|
30
|
+
VLxoMWt6uUTo4t957Nvd8Amuukum1AZx6n3IjxpI3UhoFd7JrJNfvPYkyrwcu6Ur
|
31
|
+
xk02yzVtV1mZbklvKKIelCALBeuWkIMcmJXMbjn759OOm2YbrJpEsY79W9zLdgZf
|
32
|
+
JORAC0isugdrjOh+7HDizWC+9xpvSdKSuNso9bVKO3czaBeR+i+IA43wWeUliq95
|
33
|
+
5mp49lUwPrMEh694iPac5m+oxYlcU5U+sUyArQXg+lk=
|
34
34
|
-----END CERTIFICATE-----
|
35
|
-
date: 2016-
|
35
|
+
date: 2016-12-20 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bson
|
39
39
|
requirement: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 4.2.
|
43
|
+
version: 4.2.1
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 5.0.0
|
44
47
|
type: :runtime
|
45
48
|
prerelease: false
|
46
49
|
version_requirements: !ruby/object:Gem::Requirement
|
47
50
|
requirements:
|
48
|
-
- - "
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 4.2.1
|
54
|
+
- - "<"
|
49
55
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
56
|
+
version: 5.0.0
|
51
57
|
description: A Ruby driver for MongoDB
|
52
58
|
email: mongodb-dev@googlegroups.com
|
53
59
|
executables:
|
@@ -665,7 +671,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
665
671
|
version: '0'
|
666
672
|
requirements: []
|
667
673
|
rubyforge_project:
|
668
|
-
rubygems_version: 2.5.
|
674
|
+
rubygems_version: 2.4.5.1
|
669
675
|
signing_key:
|
670
676
|
specification_version: 4
|
671
677
|
summary: Ruby driver for MongoDB
|
metadata.gz.sig
CHANGED
Binary file
|