mongo 2.13.0.rc1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mongo/auth/aws/request.rb +27 -3
- data/lib/mongo/client.rb +35 -0
- data/lib/mongo/error.rb +2 -0
- data/lib/mongo/error/invalid_server_auth_host.rb +22 -0
- data/lib/mongo/index/view.rb +3 -0
- data/lib/mongo/protocol/msg.rb +19 -0
- data/lib/mongo/server/app_metadata.rb +27 -3
- data/lib/mongo/server/connection_base.rb +34 -8
- data/lib/mongo/version.rb +1 -1
- data/spec/integration/bulk_write_spec.rb +19 -0
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +3 -3
- data/spec/integration/size_limit_spec.rb +23 -10
- data/spec/mongo/auth/aws/request_region_spec.rb +42 -0
- data/spec/mongo/auth/aws/request_spec.rb +32 -32
- data/spec/mongo/client_construction_spec.rb +112 -0
- data/spec/mongo/index/view_spec.rb +146 -0
- data/spec/mongo/server/app_metadata_shared.rb +80 -0
- metadata +985 -984
- metadata.gz.sig +0 -0
- data/spec/integration/size_limit_spec.rb~12e1e9c4f... RUBY-2242 Fix zlib compression (#2021) +0 -98
metadata.gz.sig
CHANGED
Binary file
|
data/spec/integration/size_limit_spec.rb~12e1e9c4f... RUBY-2242 Fix zlib compression (#2021)
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'BSON & command size limits' do
|
4
|
-
let(:max_document_size) { 16*1024*1024 }
|
5
|
-
|
6
|
-
before do
|
7
|
-
authorized_collection.delete_many
|
8
|
-
end
|
9
|
-
|
10
|
-
# This test uses a large document that is significantly smaller than the
|
11
|
-
# size limit. It is a basic sanity check.
|
12
|
-
it 'allows user-provided documents to be 15MiB' do
|
13
|
-
document = { key: 'a' * 15*1024*1024, _id: 'foo' }
|
14
|
-
|
15
|
-
authorized_collection.insert_one(document)
|
16
|
-
end
|
17
|
-
|
18
|
-
# This test uses a large document that is significantly larger than the
|
19
|
-
# size limit. It is a basic sanity check.
|
20
|
-
it 'fails single write of oversized documents' do
|
21
|
-
document = { key: 'a' * 17*1024*1024, _id: 'foo' }
|
22
|
-
|
23
|
-
lambda do
|
24
|
-
authorized_collection.insert_one(document)
|
25
|
-
end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/)
|
26
|
-
end
|
27
|
-
|
28
|
-
# This test checks our bulk write splitting when documents are not close
|
29
|
-
# to the limit, but where splitting is definitely required.
|
30
|
-
it 'allows split bulk write of medium sized documents' do
|
31
|
-
# 8 documents of 4 MiB each = 32 MiB total data, should be split over
|
32
|
-
# either 2 or 3 bulk writes depending on how well the driver splits
|
33
|
-
documents = []
|
34
|
-
1.upto(8) do |index|
|
35
|
-
documents << { key: 'a' * 4*1024*1024, _id: "in#{index}" }
|
36
|
-
end
|
37
|
-
|
38
|
-
authorized_collection.insert_many(documents)
|
39
|
-
authorized_collection.count_documents({}).should == 8
|
40
|
-
end
|
41
|
-
|
42
|
-
# This test ensures that document which are too big definitely fail insertion.
|
43
|
-
it 'fails bulk write of oversized documents' do
|
44
|
-
documents = []
|
45
|
-
1.upto(3) do |index|
|
46
|
-
documents << { key: 'a' * 17*1024*1024, _id: "in#{index}" }
|
47
|
-
end
|
48
|
-
|
49
|
-
lambda do
|
50
|
-
authorized_collection.insert_many(documents)
|
51
|
-
end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/)
|
52
|
-
authorized_collection.count_documents({}).should == 0
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'allows user-provided documents to be exactly 16MiB' do
|
56
|
-
# The document must contain the _id field, otherwise the server will
|
57
|
-
# add it which will increase the size of the document as persisted by
|
58
|
-
# the server.
|
59
|
-
document = { key: 'a' * (max_document_size - 28), _id: 'foo' }
|
60
|
-
expect(document.to_bson.length).to eq(max_document_size)
|
61
|
-
|
62
|
-
authorized_collection.insert_one(document)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'fails on the server when a document larger than 16MiB is inserted' do
|
66
|
-
document = { key: 'a' * (max_document_size - 27), _id: 'foo' }
|
67
|
-
expect(document.to_bson.length).to eq(max_document_size+1)
|
68
|
-
|
69
|
-
lambda do
|
70
|
-
authorized_collection.insert_one(document)
|
71
|
-
end.should raise_error(Mongo::Error::OperationFailure, /object to insert too large/)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'fails in the driver when a document larger than 16MiB+16KiB is inserted' do
|
75
|
-
document = { key: 'a' * (max_document_size - 27 + 16*1024), _id: 'foo' }
|
76
|
-
expect(document.to_bson.length).to eq(max_document_size+16*1024+1)
|
77
|
-
|
78
|
-
lambda do
|
79
|
-
authorized_collection.insert_one(document)
|
80
|
-
end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/)
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'allows bulk writes of multiple documents of exactly 16 MiB each' do
|
84
|
-
if SpecConfig.instance.compressors
|
85
|
-
pending "RUBY-2234"
|
86
|
-
end
|
87
|
-
|
88
|
-
documents = []
|
89
|
-
1.upto(3) do |index|
|
90
|
-
document = { key: 'a' * (max_document_size - 28), _id: "in#{index}" }
|
91
|
-
expect(document.to_bson.length).to eq(max_document_size)
|
92
|
-
documents << document
|
93
|
-
end
|
94
|
-
|
95
|
-
authorized_collection.insert_many(documents)
|
96
|
-
authorized_collection.count_documents({}).should == 3
|
97
|
-
end
|
98
|
-
end
|