bson 4.10.0-java → 4.12.1-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d460d1c028e7772a80132e18c31942bd3c4f211fc3746b4a39a6e1d6c81241a
4
- data.tar.gz: 8deadbdd46e3e3f5093e446b2fea191124359554716d34d9f9289ff44822e49a
3
+ metadata.gz: 72ec9fb3eada2a63cd5c657c6cb5d7bf2e2a2c48122c62775a83c3c8d5c003b4
4
+ data.tar.gz: 74891e98e279faea76e5e0adb625220e5b491d2d3b01d454a1df6e897e1d8085
5
5
  SHA512:
6
- metadata.gz: 9fe91a28391f68145170f3997f76b3e909c82cc82324b81bca37ae4bf129442b20e4bff4e30e12384e535ed1641705a753b26429811e3d30c63cf33824baf315
7
- data.tar.gz: 1be88552338a2e653bdf188a9b5ece65d5ea396c00ce48bac95a9fc9c04b3714a8f37e70c6169a6a1ebaf0a9ca2bc9cfb4dba1690c62801fc4f488fae8dc9731
6
+ metadata.gz: 645b30fd9a03d9bfb786090298b014818e7ed9b99f8bb0dbb3206c2ec6032126f8c5ee6cde49b02a8517a12d13142ae081e9d8933bdb632baf572a717995c748
7
+ data.tar.gz: ba274b84befce01e29600a24fca0ce62d12de87e5c33462991bf9403e64960a27bb69a5039618f64029b383bfb8d78c300d9b7cb61d358b139c281ba7a3bcab2
checksums.yaml.gz.sig CHANGED
@@ -1 +1,2 @@
1
- H���s�(�HG��͖P\��b7x@�0�
1
+ �9��V�Gϖ9��!�|�,�A7�?�*u�����Q���]���,[/���ꈌ睫s��&�|�� (HQ�π��a���v�iU�������.�1�8����/�&���CLF,H��}�*ż�C����8�����s�7��*?�F�K�>����I� e��z�T���� ���׳އ���M�B����ꁡ0��̋�X�߯]Qhm�s�E��o��� =m��0�j��8���U�5�>��
2
+
data.tar.gz.sig CHANGED
Binary file
data/lib/bson-ruby.jar CHANGED
Binary file
data/lib/bson/binary.rb CHANGED
@@ -207,7 +207,8 @@ module BSON
207
207
  if representation && representation != :standard
208
208
  raise ArgumentError, "Binary of type :uuid can only be stringified to :standard representation, requested: #{representation.inspect}"
209
209
  end
210
- data.split('').map { |n| '%02x' % n.ord }.join.sub(/(.{8})(.{4})(.{4})(.{12})/, '\1-\2-\3-\4')
210
+
211
+ data.split('').map { |n| '%02x' % n.ord }.join.sub(/\A(.{8})(.{4})(.{4})(.{4})(.{12})\z/, '\1-\2-\3-\4-\5')
211
212
  when :uuid_old
212
213
  if representation.nil?
213
214
  raise ArgumentError, 'Representation must be specified for BSON::Binary objects of type :uuid_old'
@@ -229,7 +230,7 @@ module BSON
229
230
  hex
230
231
  else
231
232
  raise ArgumentError, "Invalid representation: #{representation}"
232
- end.sub(/(.{8})(.{4})(.{4})(.{12})/, '\1-\2-\3-\4')
233
+ end.sub(/\A(.{8})(.{4})(.{4})(.{4})(.{12})\z/, '\1-\2-\3-\4-\5')
233
234
  else
234
235
  raise TypeError, "The type of Binary must be :uuid or :uuid_old, this object is: #{type.inspect}"
235
236
  end
data/lib/bson/document.rb CHANGED
@@ -269,27 +269,56 @@ module BSON
269
269
  end
270
270
  end
271
271
 
272
- if instance_methods.include?(:slice)
273
- # Slices a document to include only the given keys.
274
- # Will normalize symbol keys into strings.
275
- # (this method is backported from ActiveSupport::Hash)
276
- #
277
- # @example Get a document/hash with only the `name` and `age` fields present
278
- # document # => { _id: <ObjectId>, :name => 'John', :age => 30, :location => 'Earth' }
279
- # document.slice(:name, 'age') # => { name: 'John', age: 30 }
280
- # document.slice('name') # => { name: 'John' }
281
- # document.slice(:foo) # => nil
282
- #
283
- # @param [ Array<String, Symbol> ] *keys Keys, that will be kept in the resulting document
284
- #
285
- # @return [ BSON::Document ] The document with only the selected keys
286
- #
287
- # @since 4.3.1
288
- def slice(*keys)
289
- super(*keys.map{|key| convert_key(key)})
272
+ # Slices a document to include only the given keys.
273
+ # Will normalize symbol keys into strings.
274
+ # (this method is backported from ActiveSupport::Hash)
275
+ #
276
+ # @example Get a document/hash with only the `name` and `age` fields present
277
+ # document # => { _id: <ObjectId>, :name => "John", :age => 30, :location => "Earth" }
278
+ # document.slice(:name, 'age') # => { "name": "John", "age" => 30 }
279
+ # document.slice('name') # => { "name" => "John" }
280
+ # document.slice(:foo) # => {}
281
+ #
282
+ # @param [ Array<String, Symbol> ] *keys Keys, that will be kept in the resulting document
283
+ #
284
+ # @return [ BSON::Document ] The document with only the selected keys
285
+ #
286
+ # @since 4.3.1
287
+ def slice(*keys)
288
+ keys.each_with_object(self.class.new) do |key, hash|
289
+ if key?(key)
290
+ hash[key] = self[key]
291
+ end
290
292
  end
291
293
  end
292
294
 
295
+ # Returns a new document consisting of the current document minus the
296
+ # specified keys.
297
+ #
298
+ # The keys to be removed can be specified as either strings or symbols.
299
+ #
300
+ # @example Get a document/hash with only the `name` and `age` fields removed
301
+ # document # => { _id: <ObjectId>, :name => 'John', :age => 30, :location => 'Earth' }
302
+ # document.except(:name, 'age') # => { _id: <ObjectId>, location: 'Earth' }
303
+ #
304
+ # @param [ Array<String, Symbol> ] *keys Keys, that will be removed in the resulting document
305
+ #
306
+ # @return [ BSON::Document ] The document with the specified keys removed.
307
+ #
308
+ # @note This method is always defined, even if Hash already contains a
309
+ # definition of #except, because ActiveSupport unconditionally defines
310
+ # its version of #except which doesn't work for BSON::Document which
311
+ # causes problems if ActiveSupport is loaded after bson-ruby is.
312
+ def except(*keys)
313
+ copy = dup
314
+ keys.each {|key| copy.delete(key)}
315
+ copy
316
+ end
317
+
318
+ def symbolize_keys!
319
+ raise ArgumentError, 'symbolize_keys! is not supported on BSON::Document instances. Please convert the document to hash first (using #to_h), then call #symbolize_keys! on the Hash instance'
320
+ end
321
+
293
322
  private
294
323
 
295
324
  def convert_key(key)
data/lib/bson/ext_json.rb CHANGED
@@ -219,6 +219,14 @@ module BSON
219
219
  raise Error::ExtJSONParseError, "Invalid subType value in $binary: #{value}"
220
220
  end
221
221
  create_binary(encoded_value, subtype)
222
+
223
+ when '$uuid'
224
+ unless /\A[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\z/.match(value)
225
+ raise Error::ExtJSONParseError, "Invalid $uuid value: #{value}"
226
+ end
227
+
228
+ return Binary.from_uuid(value)
229
+
222
230
  when '$code'
223
231
  unless value.is_a?(String)
224
232
  raise Error::ExtJSONParseError, "Invalid $code value: #{value}"
data/lib/bson/version.rb CHANGED
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "4.10.0".freeze
16
+ VERSION = "4.12.1".freeze
17
17
  end
@@ -255,7 +255,7 @@ describe BSON::Binary do
255
255
  let(:obj) { described_class.new("\x00" * 16, :uuid) }
256
256
 
257
257
  it 'accepts symbol representation' do
258
- expect(obj.to_uuid(:standard)).to eq('00000000-0000-0000-0000000000000000')
258
+ expect(obj.to_uuid(:standard)).to eq('00000000-0000-0000-0000-000000000000')
259
259
  end
260
260
 
261
261
  it 'rejects string representation' do
@@ -136,6 +136,10 @@ describe "BSON::Binary - UUID spec tests" do
136
136
  it 'decodes as python legacy' do
137
137
  expect(binary.to_uuid(:python_legacy).gsub('-', '').upcase).not_to eq("00112233445566778899AABBCCDDEEFF")
138
138
  end
139
+
140
+ it 'expects four dashes when output as String' do
141
+ expect(binary.to_uuid(:csharp_legacy)).to eq("00112233-4455-6677-8899-aabbccddeeff")
142
+ end
139
143
  end
140
144
 
141
145
  context ':uuid_old, java legacy encoded' do
@@ -154,6 +158,10 @@ describe "BSON::Binary - UUID spec tests" do
154
158
  it 'decodes as python legacy' do
155
159
  expect(binary.to_uuid(:python_legacy).gsub('-', '').upcase).not_to eq("00112233445566778899AABBCCDDEEFF")
156
160
  end
161
+
162
+ it 'expects four dashes when output as String' do
163
+ expect(binary.to_uuid(:java_legacy)).to eq("00112233-4455-6677-8899-aabbccddeeff")
164
+ end
157
165
  end
158
166
 
159
167
  context ':uuid_old, python legacy encoded' do
@@ -172,6 +180,10 @@ describe "BSON::Binary - UUID spec tests" do
172
180
  it 'decodes as python legacy' do
173
181
  expect(binary.to_uuid(:python_legacy).gsub('-', '').upcase).to eq("00112233445566778899AABBCCDDEEFF")
174
182
  end
183
+
184
+ it 'expects four dashes when output as String' do
185
+ expect(binary.to_uuid(:python_legacy)).to eq("00112233-4455-6677-8899-aabbccddeeff")
186
+ end
175
187
  end
176
188
  end
177
189
  end
@@ -30,8 +30,8 @@ describe BSON::ByteBuffer do
30
30
  let(:buffer) do
31
31
  described_class.new
32
32
  end
33
-
34
- context '#put_int32' do
33
+
34
+ context '#put_int32' do
35
35
  before do
36
36
  buffer.put_int32(5)
37
37
  end
@@ -42,7 +42,6 @@ describe BSON::ByteBuffer do
42
42
  end
43
43
  end
44
44
 
45
-
46
45
  context 'when the byte buffer is initialized with some bytes' do
47
46
 
48
47
  let(:buffer) do
@@ -53,6 +52,50 @@ describe BSON::ByteBuffer do
53
52
  expect(buffer.length).to eq(2)
54
53
  end
55
54
  end
55
+
56
+ context 'after the byte buffer was read from' do
57
+
58
+ let(:buffer) do
59
+ described_class.new({}.to_bson.to_s)
60
+ end
61
+
62
+ it 'returns the number of bytes remaining in the buffer' do
63
+ expect(buffer.length).to eq(5)
64
+ buffer.get_int32
65
+ expect(buffer.length).to eq(1)
66
+ end
67
+ end
68
+
69
+ context 'after the byte buffer was converted to string' do
70
+
71
+ shared_examples 'returns the total buffer length' do
72
+ it 'returns the total buffer length' do
73
+ expect(buffer.length).to eq(5)
74
+ buffer.to_s.length.should == 5
75
+ expect(buffer.length).to eq(5)
76
+ end
77
+ end
78
+
79
+ context 'read buffer' do
80
+
81
+ let(:buffer) do
82
+ described_class.new({}.to_bson.to_s)
83
+ end
84
+
85
+ include_examples 'returns the total buffer length'
86
+ end
87
+
88
+ context 'write buffer' do
89
+
90
+ let(:buffer) do
91
+ described_class.new.tap do |buffer|
92
+ buffer.put_bytes('hello')
93
+ end
94
+ end
95
+
96
+ include_examples 'returns the total buffer length'
97
+ end
98
+ end
56
99
  end
57
100
 
58
101
  describe '#rewind!' do
@@ -107,4 +150,81 @@ describe BSON::ByteBuffer do
107
150
  expect(buffer.write_position).to eq(1)
108
151
  end
109
152
  end
153
+
154
+ describe 'write followed by read' do
155
+ let(:buffer) do
156
+ described_class.new
157
+ end
158
+
159
+ context 'one cycle' do
160
+ it 'returns the written data' do
161
+ buffer.put_cstring('hello')
162
+ buffer.get_cstring.should == 'hello'
163
+ end
164
+ end
165
+
166
+ context 'two cycles' do
167
+ it 'returns the written data' do
168
+ buffer.put_cstring('hello')
169
+ buffer.get_cstring.should == 'hello'
170
+
171
+ buffer.put_cstring('world')
172
+ buffer.get_cstring.should == 'world'
173
+ end
174
+ end
175
+
176
+ context 'mixed cycles' do
177
+ it 'returns the written data' do
178
+ if BSON::Environment.jruby?
179
+ pending 'RUBY-2334'
180
+ end
181
+
182
+ buffer.put_int32(1)
183
+ buffer.put_int32(2)
184
+
185
+ buffer.get_int32.should == 1
186
+
187
+ buffer.put_int32(3)
188
+
189
+ buffer.get_int32.should == 2
190
+ buffer.get_int32.should == 3
191
+ end
192
+ end
193
+ end
194
+
195
+ describe '#to_s' do
196
+ context 'read buffer' do
197
+ let(:buffer) do
198
+ described_class.new("\x18\x00\x00\x00*\x00\x00\x00")
199
+ end
200
+
201
+ it 'returns the data' do
202
+ buffer.to_s.should == "\x18\x00\x00\x00*\x00\x00\x00"
203
+ end
204
+
205
+ it 'returns the remaining buffer contents after a read' do
206
+ buffer.to_s.should == "\x18\x00\x00\x00*\x00\x00\x00"
207
+ buffer.get_int32.should == 24
208
+ buffer.to_s.should == "*\x00\x00\x00"
209
+ end
210
+ end
211
+
212
+ context 'write buffer' do
213
+ let(:buffer) do
214
+ described_class.new.tap do |buffer|
215
+ buffer.put_int32(24)
216
+ end
217
+ end
218
+
219
+ it 'returns the data' do
220
+ buffer.to_s.should == "\x18\x00\x00\x00".force_encoding('binary')
221
+ end
222
+
223
+ it 'returns the complete buffer contents after a write' do
224
+ buffer.to_s.should == "\x18\x00\x00\x00".force_encoding('binary')
225
+ buffer.put_int32(42)
226
+ buffer.to_s.should == "\x18\x00\x00\x00*\x00\x00\x00".force_encoding('binary')
227
+ end
228
+ end
229
+ end
110
230
  end
@@ -0,0 +1,46 @@
1
+ # Copyright (C) 2021 MongoDB Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "spec_helper"
16
+
17
+ # BSON::Document ActiveSupport extensions
18
+ describe BSON::Document do
19
+ require_active_support
20
+
21
+ describe '#symbolize_keys' do
22
+ context 'string keys' do
23
+ let(:doc) do
24
+ described_class.new('foo' => 'bar')
25
+ end
26
+
27
+ it 'works correctly' do
28
+ doc.symbolize_keys.should == {foo: 'bar'}
29
+ end
30
+ end
31
+ end
32
+
33
+ describe '#symbolize_keys!' do
34
+ context 'string keys' do
35
+ let(:doc) do
36
+ described_class.new('foo' => 'bar')
37
+ end
38
+
39
+ it 'raises ArgumentError' do
40
+ lambda do
41
+ doc.symbolize_keys!
42
+ end.should raise_error(ArgumentError, /symbolize_keys! is not supported on BSON::Document instances/)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -215,6 +215,10 @@ describe BSON::Document do
215
215
 
216
216
  context "when provided string keys" do
217
217
 
218
+ it "is a BSON Document" do
219
+ expect(document.slice("key1")).to be_a(BSON::Document)
220
+ end
221
+
218
222
  it "returns the partial document" do
219
223
  expect(document.slice("key1")).to contain_exactly(['key1', 'value1'])
220
224
  end
@@ -222,13 +226,45 @@ describe BSON::Document do
222
226
 
223
227
  context "when provided symbol keys" do
224
228
 
229
+ it "is a BSON Document" do
230
+ expect(document.slice(:key1)).to be_a(BSON::Document)
231
+ end
232
+
225
233
  it "returns the partial document" do
226
234
  expect(document.slice(:key1)).to contain_exactly(['key1', 'value1'])
227
235
  end
228
236
  end
237
+
238
+ context "when provided keys that do not exist in the document" do
239
+
240
+ it "returns only the keys that exist in the document" do
241
+ expect(document.slice(:key1, :key3)).to contain_exactly(['key1', 'value1'])
242
+ end
243
+ end
229
244
  end
230
245
  end
231
246
 
247
+ describe "#except" do
248
+ let(:document) do
249
+ described_class.new("key1" => "value1", key2: "value2")
250
+ end
251
+
252
+ context "when provided string keys" do
253
+
254
+ it "returns the partial document" do
255
+ expect(document.except("key1")).to contain_exactly(['key2', 'value2'])
256
+ end
257
+ end
258
+
259
+ context "when provided symbol keys" do
260
+
261
+ it "returns the partial document" do
262
+ expect(document.except(:key1)).to contain_exactly(['key2', 'value2'])
263
+ end
264
+ end
265
+ end
266
+
267
+
232
268
  describe "#delete" do
233
269
 
234
270
  shared_examples_for "a document with deletable pairs" do
@@ -0,0 +1,57 @@
1
+ # Copyright (C) 2021 MongoDB Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "spec_helper"
16
+
17
+ describe 'Hash ActiveSupport extensions' do
18
+ require_active_support
19
+
20
+ describe '#symbolize_keys' do
21
+ let(:symbolized) { hash.symbolize_keys }
22
+
23
+ shared_examples 'works correctly' do
24
+ it 'returns a hash' do
25
+ symbolized.class.should be Hash
26
+ end
27
+
28
+ it 'works correctly' do
29
+ hash.symbolize_keys.should == {foo: 'bar'}
30
+ end
31
+ end
32
+
33
+ context 'string keys' do
34
+ let(:hash) do
35
+ {'foo' => 'bar'}
36
+ end
37
+
38
+ include_examples 'works correctly'
39
+ end
40
+
41
+ context 'symbol keys' do
42
+ let(:hash) do
43
+ {foo: 'bar'}
44
+ end
45
+
46
+ include_examples 'works correctly'
47
+ end
48
+
49
+ context 'both string and symbol keys' do
50
+ let(:hash) do
51
+ {'foo' => 42, foo: 'bar'}
52
+ end
53
+
54
+ include_examples 'works correctly'
55
+ end
56
+ end
57
+ end
@@ -244,6 +244,16 @@ describe Hash do
244
244
  /(Hash value for key 'foo'|Value) does not define its BSON serialized type:.*HashSpecUnserializableClass/)
245
245
  end
246
246
  end
247
+
248
+ context 'when reading from a byte buffer that was previously written to' do
249
+ let(:buffer) do
250
+ {foo: 42}.to_bson
251
+ end
252
+
253
+ it 'returns the original hash' do
254
+ expect(Hash.from_bson(buffer)).to eq('foo' => 42)
255
+ end
256
+ end
247
257
  end
248
258
 
249
259
  describe '#to_bson' do
@@ -310,4 +320,50 @@ describe Hash do
310
320
  end
311
321
  end
312
322
  end
323
+
324
+ describe '#from_bson' do
325
+ context 'when bson document has duplicate keys' do
326
+ let(:buf) do
327
+ buf = BSON::ByteBuffer.new
328
+ buf.put_int32(37)
329
+ buf.put_byte("\x02")
330
+ buf.put_cstring('foo')
331
+ buf.put_string('bar')
332
+ buf.put_byte("\x02")
333
+ buf.put_cstring('foo')
334
+ buf.put_string('overwrite')
335
+ buf.put_byte("\x00")
336
+
337
+ BSON::ByteBuffer.new(buf.to_s)
338
+ end
339
+
340
+ let(:doc) { Hash.from_bson(buf) }
341
+
342
+ it 'overwrites first value with second value' do
343
+ doc.should == {'foo' => 'overwrite'}
344
+ end
345
+ end
346
+
347
+ context 'when bson document has string and symbol keys of the same name' do
348
+ let(:buf) do
349
+ buf = BSON::ByteBuffer.new
350
+ buf.put_int32(31)
351
+ buf.put_byte("\x02")
352
+ buf.put_cstring('foo')
353
+ buf.put_string('bar')
354
+ buf.put_byte("\x0e")
355
+ buf.put_cstring('foo')
356
+ buf.put_string('bar')
357
+ buf.put_byte("\x00")
358
+
359
+ BSON::ByteBuffer.new(buf.to_s)
360
+ end
361
+
362
+ let(:doc) { Hash.from_bson(buf) }
363
+
364
+ it 'overwrites first value with second value' do
365
+ doc.should == {'foo' => :bar}
366
+ end
367
+ end
368
+ end
313
369
  end
data/spec/spec_helper.rb CHANGED
@@ -17,6 +17,7 @@ DRIVER_COMMON_BSON_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/decimal128/
17
17
  BSON_CORPUS_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/corpus/*.json").sort
18
18
  BSON_CORPUS_LEGACY_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/corpus_legacy/*.json").sort
19
19
 
20
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "shared", "lib"))
20
21
  $LOAD_PATH.unshift(File.dirname(__FILE__))
21
22
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
22
23
 
@@ -40,6 +41,8 @@ unless ENV['CI'] || BSON::Environment.jruby?
40
41
  end
41
42
  end
42
43
 
44
+ require 'mrss/lite_constraints'
45
+
43
46
  Dir["./spec/support/**/*.rb"].each { |file| require file }
44
47
 
45
48
  # Alternate IO class that returns a String from #readbyte.
@@ -71,4 +74,6 @@ RSpec.configure do |config|
71
74
  end
72
75
  end
73
76
  end
77
+
78
+ config.extend Mrss::LiteConstraints
74
79
  end
@@ -39,6 +39,12 @@
39
39
  "canonical_bson": "1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400",
40
40
  "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"04\"}}}"
41
41
  },
42
+ {
43
+ "description": "subtype 0x04 UUID",
44
+ "canonical_bson": "1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400",
45
+ "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"04\"}}}",
46
+ "degenerate_extjson": "{\"x\" : { \"$uuid\" : \"73ffd264-44b3-4c69-90e8-e7d1dfc035d4\"}}"
47
+ },
42
48
  {
43
49
  "description": "subtype 0x05",
44
50
  "canonical_bson": "1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400",
@@ -81,5 +87,27 @@
81
87
  "description": "subtype 0x02 length negative one",
82
88
  "bson": "130000000578000600000002FFFFFFFFFFFF00"
83
89
  }
90
+ ],
91
+ "parseErrors": [
92
+ {
93
+ "description": "$uuid wrong type",
94
+ "string": "{\"x\" : { \"$uuid\" : { \"data\" : \"73ffd264-44b3-4c69-90e8-e7d1dfc035d4\"}}}"
95
+ },
96
+ {
97
+ "description": "$uuid invalid value--too short",
98
+ "string": "{\"x\" : { \"$uuid\" : \"73ffd264-44b3-90e8-e7d1dfc035d4\"}}"
99
+ },
100
+ {
101
+ "description": "$uuid invalid value--too long",
102
+ "string": "{\"x\" : { \"$uuid\" : \"73ffd264-44b3-4c69-90e8-e7d1dfc035d4-789e4\"}}"
103
+ },
104
+ {
105
+ "description": "$uuid invalid value--misplaced hyphens",
106
+ "string": "{\"x\" : { \"$uuid\" : \"73ff-d26444b-34c6-990e8e-7d1dfc035d4\"}}"
107
+ },
108
+ {
109
+ "description": "$uuid invalid value--too many hyphens",
110
+ "string": "{\"x\" : { \"$uuid\" : \"----d264-44b3-4--9-90e8-e7d1dfc0----\"}}"
111
+ }
84
112
  ]
85
113
  }
@@ -6,7 +6,8 @@ class SpecConfig
6
6
  COMPACTION_CHANCE = 0.001
7
7
 
8
8
  def active_support?
9
- %w(1 true yes).include?(ENV['WITH_ACTIVE_SUPPORT'])
9
+ %w(1 true yes).include?(ENV['WITH_ACTIVE_SUPPORT']) ||
10
+ ENV['WITH_ACTIVE_SUPPORT'] =~ /[0-9]/ && ENV['WITH_ACTIVE_SUPPORT'] != '0'
10
11
  end
11
12
 
12
13
  def compact?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.10.0
4
+ version: 4.12.1
5
5
  platform: java
6
6
  authors:
7
7
  - Tyler Brock
@@ -15,8 +15,8 @@ cert_chain:
15
15
  - |
16
16
  -----BEGIN CERTIFICATE-----
17
17
  MIIDRDCCAiygAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBtkcml2
18
- ZXItcnVieS9EQz0xMGdlbi9EQz1jb20wHhcNMjAwMTIzMTkzNjAxWhcNMjEwMTIy
19
- MTkzNjAxWjAmMSQwIgYDVQQDDBtkcml2ZXItcnVieS9EQz0xMGdlbi9EQz1jb20w
18
+ ZXItcnVieS9EQz0xMGdlbi9EQz1jb20wHhcNMjEwMjA5MTQxOTU3WhcNMjIwMjA5
19
+ MTQxOTU3WjAmMSQwIgYDVQQDDBtkcml2ZXItcnVieS9EQz0xMGdlbi9EQz1jb20w
20
20
  ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDRXUgGvH0ZtWwDPc2umdHw
21
21
  B+INNm6jNTRp8PMyUKxPzxaxX2OiBQk9gLC3zsK9ZmlZu4lNfpHVSCEPoiP/fhPg
22
22
  Kyfq2xld3Qz0Pki5d5i0/r14343MTKiNiFulLlbbdlN0cXeEFNJHUycZnD2LOXwz
@@ -26,14 +26,14 @@ cert_chain:
26
26
  AgMBAAGjfTB7MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBRbd1mx
27
27
  fvSaVIwKI+tnEAYDW/B81zAgBgNVHREEGTAXgRVkcml2ZXItcnVieUAxMGdlbi5j
28
28
  b20wIAYDVR0SBBkwF4EVZHJpdmVyLXJ1YnlAMTBnZW4uY29tMA0GCSqGSIb3DQEB
29
- CwUAA4IBAQBfX4dwxG5PhtxES/LDEOaZIZXyaX6CKe367zhW+HxWbSOXMQJFkIQj
30
- m7tzT+sDFJXyiOv5cPtfpUam5pTiryzRw5HD6oxlPIt5vO15EJ69v++3m7shMLbw
31
- amZOajKXmu2ZGZfhOtj7bOTwmOj1AnWLKeOQIR3STvvfZCD+6dt1XenW7CdjCsxE
32
- ifervPjLFqFPsMOgaxikhgPK6bRtszrQhJSYlifKKzxbX1hYAsmGL7IxjubFSV5r
33
- gpvfPNWMwyBDlHaNS3GfO6cRRxBOvEG05GUCsvtTY4Bpe8yjE64wg1ymb47LMOnv
34
- Qb1lGORmf/opg45mluKUYl7pQNZHD0d3
29
+ CwUAA4IBAQCYGRgQbtk+g+Nuwg15p8jb+8bJlwHFHkb8rkLn00OPXLk3uBhImOKZ
30
+ mhwwr/8ZBkeE/PBDxkQjeua+NpqSaPr1lvXQaGpHxJzpR/BmSteeoF49jBu0dHaz
31
+ MRghinst6ROS1qVRae0z+wkbnufpH/NxdCUufb639nAlZguT2rGqvM6VZCC8eSO9
32
+ KfJA7/MEE+qQtiQgJaAUVRaGC8fLtmS555BPjNVITJs+BcGDYWh2clWuqlzjHOp3
33
+ YoFhlyUEi7VLlqNH0H/JFttVZK6+qmLelkVNcIYVLeWOB4Lf4VxEiYGEK1ORxsrY
34
+ iyYKJJALWY1FAInGRIlvkN+B8o3yIhq1
35
35
  -----END CERTIFICATE-----
36
- date: 2020-07-17 00:00:00.000000000 Z
36
+ date: 2021-05-28 00:00:00.000000000 Z
37
37
  dependencies: []
38
38
  description: A fully featured BSON specification implementation in Ruby
39
39
  email:
@@ -102,10 +102,12 @@ files:
102
102
  - spec/bson/date_spec.rb
103
103
  - spec/bson/date_time_spec.rb
104
104
  - spec/bson/decimal128_spec.rb
105
+ - spec/bson/document_as_spec.rb
105
106
  - spec/bson/document_spec.rb
106
107
  - spec/bson/ext_json_parse_spec.rb
107
108
  - spec/bson/false_class_spec.rb
108
109
  - spec/bson/float_spec.rb
110
+ - spec/bson/hash_as_spec.rb
109
111
  - spec/bson/hash_spec.rb
110
112
  - spec/bson/int32_spec.rb
111
113
  - spec/bson/int64_spec.rb
@@ -230,111 +232,113 @@ summary: Ruby implementation of the BSON specification
230
232
  test_files:
231
233
  - spec/spec_helper.rb
232
234
  - spec/bson_spec.rb
235
+ - spec/bson/true_class_spec.rb
236
+ - spec/bson/false_class_spec.rb
237
+ - spec/bson/object_spec.rb
238
+ - spec/bson/json_spec.rb
239
+ - spec/bson/undefined_spec.rb
240
+ - spec/bson/time_with_zone_spec.rb
241
+ - spec/bson/max_key_spec.rb
242
+ - spec/bson/float_spec.rb
243
+ - spec/bson/int32_spec.rb
244
+ - spec/bson/boolean_spec.rb
245
+ - spec/bson/int64_spec.rb
246
+ - spec/bson/min_key_spec.rb
247
+ - spec/bson/date_time_spec.rb
248
+ - spec/bson/date_spec.rb
249
+ - spec/bson/registry_spec.rb
250
+ - spec/bson/hash_as_spec.rb
251
+ - spec/bson/regexp_spec.rb
252
+ - spec/bson/timestamp_spec.rb
253
+ - spec/bson/decimal128_spec.rb
254
+ - spec/bson/binary_uuid_spec.rb
255
+ - spec/bson/binary_spec.rb
256
+ - spec/bson/document_as_spec.rb
257
+ - spec/bson/code_spec.rb
258
+ - spec/bson/array_spec.rb
259
+ - spec/bson/time_spec.rb
260
+ - spec/bson/raw_spec.rb
261
+ - spec/bson/string_spec.rb
262
+ - spec/bson/hash_spec.rb
263
+ - spec/bson/object_id_spec.rb
264
+ - spec/bson/ext_json_parse_spec.rb
265
+ - spec/bson/document_spec.rb
266
+ - spec/bson/symbol_spec.rb
267
+ - spec/bson/open_struct_spec.rb
268
+ - spec/bson/code_with_scope_spec.rb
269
+ - spec/bson/symbol_raw_spec.rb
270
+ - spec/bson/byte_buffer_write_spec.rb
271
+ - spec/bson/byte_buffer_spec.rb
272
+ - spec/bson/nil_class_spec.rb
273
+ - spec/bson/byte_buffer_read_spec.rb
274
+ - spec/bson/config_spec.rb
275
+ - spec/bson/integer_spec.rb
276
+ - spec/support/shared_examples.rb
277
+ - spec/support/utils.rb
278
+ - spec/support/spec_config.rb
233
279
  - spec/spec_tests/corpus_spec.rb
234
- - spec/spec_tests/common_driver_spec.rb
235
280
  - spec/spec_tests/corpus_legacy_spec.rb
236
- - spec/spec_tests/data/corpus/decimal128-7.json
237
- - spec/spec_tests/data/corpus/top.json
238
- - spec/spec_tests/data/corpus/array.json
239
- - spec/spec_tests/data/corpus/null.json
240
- - spec/spec_tests/data/corpus/document.json
241
- - spec/spec_tests/data/corpus/decimal128-2.json
242
- - spec/spec_tests/data/corpus/decimal128-6.json
243
- - spec/spec_tests/data/corpus/boolean.json
244
- - spec/spec_tests/data/corpus/README.md
245
- - spec/spec_tests/data/corpus/maxkey.json
246
- - spec/spec_tests/data/corpus/binary.json
247
- - spec/spec_tests/data/corpus/multi-type.json
248
- - spec/spec_tests/data/corpus/timestamp.json
249
- - spec/spec_tests/data/corpus/multi-type-deprecated.json
250
- - spec/spec_tests/data/corpus/dbpointer.json
251
- - spec/spec_tests/data/corpus/oid.json
252
- - spec/spec_tests/data/corpus/regex.json
253
- - spec/spec_tests/data/corpus/minkey.json
254
- - spec/spec_tests/data/corpus/symbol.json
255
- - spec/spec_tests/data/corpus/dbref.json
256
- - spec/spec_tests/data/corpus/decimal128-1.json
257
- - spec/spec_tests/data/corpus/undefined.json
258
- - spec/spec_tests/data/corpus/double.json
259
- - spec/spec_tests/data/corpus/decimal128-4.json
260
- - spec/spec_tests/data/corpus/decimal128-3.json
261
- - spec/spec_tests/data/corpus/decimal128-5.json
262
- - spec/spec_tests/data/corpus/int32.json
263
- - spec/spec_tests/data/corpus/string.json
264
- - spec/spec_tests/data/corpus/code.json
265
- - spec/spec_tests/data/corpus/code_w_scope.json
266
- - spec/spec_tests/data/corpus/int64.json
267
- - spec/spec_tests/data/corpus/datetime.json
281
+ - spec/spec_tests/common_driver_spec.rb
282
+ - spec/spec_tests/data/corpus_legacy/timestamp.json
268
283
  - spec/spec_tests/data/corpus_legacy/top.json
269
- - spec/spec_tests/data/corpus_legacy/array.json
270
- - spec/spec_tests/data/corpus_legacy/null.json
271
- - spec/spec_tests/data/corpus_legacy/document.json
272
- - spec/spec_tests/data/corpus_legacy/boolean.json
273
284
  - spec/spec_tests/data/corpus_legacy/maxkey.json
274
- - spec/spec_tests/data/corpus_legacy/binary.json
275
- - spec/spec_tests/data/corpus_legacy/timestamp.json
276
- - spec/spec_tests/data/corpus_legacy/oid.json
277
- - spec/spec_tests/data/corpus_legacy/regex.json
278
- - spec/spec_tests/data/corpus_legacy/minkey.json
279
285
  - spec/spec_tests/data/corpus_legacy/undefined.json
280
- - spec/spec_tests/data/corpus_legacy/double.json
286
+ - spec/spec_tests/data/corpus_legacy/array.json
281
287
  - spec/spec_tests/data/corpus_legacy/int32.json
288
+ - spec/spec_tests/data/corpus_legacy/oid.json
289
+ - spec/spec_tests/data/corpus_legacy/regex.json
290
+ - spec/spec_tests/data/corpus_legacy/binary.json
291
+ - spec/spec_tests/data/corpus_legacy/null.json
282
292
  - spec/spec_tests/data/corpus_legacy/string.json
293
+ - spec/spec_tests/data/corpus_legacy/document.json
294
+ - spec/spec_tests/data/corpus_legacy/minkey.json
295
+ - spec/spec_tests/data/corpus_legacy/boolean.json
283
296
  - spec/spec_tests/data/corpus_legacy/code.json
297
+ - spec/spec_tests/data/corpus_legacy/double.json
284
298
  - spec/spec_tests/data/corpus_legacy/code_w_scope.json
285
299
  - spec/spec_tests/data/corpus_legacy/failures/dbpointer.json
286
300
  - spec/spec_tests/data/corpus_legacy/failures/symbol.json
287
301
  - spec/spec_tests/data/corpus_legacy/failures/int64.json
288
302
  - spec/spec_tests/data/corpus_legacy/failures/datetime.json
289
- - spec/spec_tests/data/decimal128/decimal128-7.json
290
- - spec/spec_tests/data/decimal128/decimal128-2.json
303
+ - spec/spec_tests/data/decimal128/decimal128-4.json
291
304
  - spec/spec_tests/data/decimal128/decimal128-6.json
305
+ - spec/spec_tests/data/decimal128/decimal128-2.json
292
306
  - spec/spec_tests/data/decimal128/decimal128-1.json
293
- - spec/spec_tests/data/decimal128/decimal128-4.json
307
+ - spec/spec_tests/data/decimal128/decimal128-7.json
294
308
  - spec/spec_tests/data/decimal128/decimal128-3.json
295
309
  - spec/spec_tests/data/decimal128/decimal128-5.json
296
- - spec/support/utils.rb
297
- - spec/support/shared_examples.rb
298
- - spec/support/spec_config.rb
299
- - spec/runners/common_driver.rb
310
+ - spec/spec_tests/data/corpus/timestamp.json
311
+ - spec/spec_tests/data/corpus/top.json
312
+ - spec/spec_tests/data/corpus/maxkey.json
313
+ - spec/spec_tests/data/corpus/decimal128-4.json
314
+ - spec/spec_tests/data/corpus/dbpointer.json
315
+ - spec/spec_tests/data/corpus/undefined.json
316
+ - spec/spec_tests/data/corpus/array.json
317
+ - spec/spec_tests/data/corpus/decimal128-6.json
318
+ - spec/spec_tests/data/corpus/README.md
319
+ - spec/spec_tests/data/corpus/int32.json
320
+ - spec/spec_tests/data/corpus/oid.json
321
+ - spec/spec_tests/data/corpus/regex.json
322
+ - spec/spec_tests/data/corpus/binary.json
323
+ - spec/spec_tests/data/corpus/symbol.json
324
+ - spec/spec_tests/data/corpus/null.json
325
+ - spec/spec_tests/data/corpus/decimal128-2.json
326
+ - spec/spec_tests/data/corpus/string.json
327
+ - spec/spec_tests/data/corpus/document.json
328
+ - spec/spec_tests/data/corpus/dbref.json
329
+ - spec/spec_tests/data/corpus/decimal128-1.json
330
+ - spec/spec_tests/data/corpus/minkey.json
331
+ - spec/spec_tests/data/corpus/boolean.json
332
+ - spec/spec_tests/data/corpus/int64.json
333
+ - spec/spec_tests/data/corpus/code.json
334
+ - spec/spec_tests/data/corpus/decimal128-7.json
335
+ - spec/spec_tests/data/corpus/decimal128-3.json
336
+ - spec/spec_tests/data/corpus/decimal128-5.json
337
+ - spec/spec_tests/data/corpus/double.json
338
+ - spec/spec_tests/data/corpus/multi-type.json
339
+ - spec/spec_tests/data/corpus/multi-type-deprecated.json
340
+ - spec/spec_tests/data/corpus/datetime.json
341
+ - spec/spec_tests/data/corpus/code_w_scope.json
300
342
  - spec/runners/corpus_legacy.rb
301
343
  - spec/runners/corpus.rb
302
- - spec/bson/code_spec.rb
303
- - spec/bson/byte_buffer_read_spec.rb
304
- - spec/bson/int32_spec.rb
305
- - spec/bson/max_key_spec.rb
306
- - spec/bson/time_spec.rb
307
- - spec/bson/array_spec.rb
308
- - spec/bson/date_time_spec.rb
309
- - spec/bson/document_spec.rb
310
- - spec/bson/float_spec.rb
311
- - spec/bson/nil_class_spec.rb
312
- - spec/bson/time_with_zone_spec.rb
313
- - spec/bson/ext_json_parse_spec.rb
314
- - spec/bson/string_spec.rb
315
- - spec/bson/open_struct_spec.rb
316
- - spec/bson/config_spec.rb
317
- - spec/bson/false_class_spec.rb
318
- - spec/bson/raw_spec.rb
319
- - spec/bson/regexp_spec.rb
320
- - spec/bson/binary_spec.rb
321
- - spec/bson/object_spec.rb
322
- - spec/bson/decimal128_spec.rb
323
- - spec/bson/binary_uuid_spec.rb
324
- - spec/bson/boolean_spec.rb
325
- - spec/bson/byte_buffer_spec.rb
326
- - spec/bson/json_spec.rb
327
- - spec/bson/symbol_spec.rb
328
- - spec/bson/integer_spec.rb
329
- - spec/bson/byte_buffer_write_spec.rb
330
- - spec/bson/registry_spec.rb
331
- - spec/bson/code_with_scope_spec.rb
332
- - spec/bson/true_class_spec.rb
333
- - spec/bson/undefined_spec.rb
334
- - spec/bson/object_id_spec.rb
335
- - spec/bson/timestamp_spec.rb
336
- - spec/bson/hash_spec.rb
337
- - spec/bson/symbol_raw_spec.rb
338
- - spec/bson/min_key_spec.rb
339
- - spec/bson/int64_spec.rb
340
- - spec/bson/date_spec.rb
344
+ - spec/runners/common_driver.rb
metadata.gz.sig CHANGED
Binary file