bson 4.8.1-java → 4.8.2-java
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/bson-ruby.jar +0 -0
- data/lib/bson/array.rb +7 -1
- data/lib/bson/code_with_scope.rb +7 -1
- data/lib/bson/db_pointer.rb +7 -1
- data/lib/bson/ext_json.rb +2 -2
- data/lib/bson/version.rb +1 -1
- data/spec/bson/ext_json_parse_spec.rb +34 -2
- metadata +82 -82
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2b2ab7485ae7c9a2e45f6abc69e24e60901937f1a55da3fab3fbec017a71ee7
|
4
|
+
data.tar.gz: 6531f5f6b2d8e49109fd62e98e2f59beed08b7d9ce022b65ce3800d26d000db8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 725ecd612c211548cba77581ae4116a875dd398164a996f3b39f7162fdf62a1681215ae5d8b2d7e5403b30a999d7490e59e4cabce88acb50bc355951289dd5dd
|
7
|
+
data.tar.gz: c20a4b544803cdf5d15d7df5b9a541b77221446dbe104a685083dc23ef11f6d02818c83a5edaf9a7ec9df8abdd806f607a8bd601c619243a635c5b59814ea5b8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/bson-ruby.jar
CHANGED
Binary file
|
data/lib/bson/array.rb
CHANGED
@@ -122,7 +122,13 @@ module BSON
|
|
122
122
|
buffer.get_int32 # throw away the length
|
123
123
|
while (type = buffer.get_byte) != NULL_BYTE
|
124
124
|
buffer.get_cstring
|
125
|
-
|
125
|
+
cls = BSON::Registry.get(type)
|
126
|
+
value = if options.empty?
|
127
|
+
cls.from_bson(buffer)
|
128
|
+
else
|
129
|
+
cls.from_bson(buffer, **options)
|
130
|
+
end
|
131
|
+
array << value
|
126
132
|
end
|
127
133
|
array
|
128
134
|
end
|
data/lib/bson/code_with_scope.rb
CHANGED
@@ -120,7 +120,13 @@ module BSON
|
|
120
120
|
# @since 2.0.0
|
121
121
|
def self.from_bson(buffer, **options)
|
122
122
|
buffer.get_int32 # Throw away the total length.
|
123
|
-
|
123
|
+
javascript = buffer.get_string
|
124
|
+
scope = if options.empty?
|
125
|
+
::Hash.from_bson(buffer)
|
126
|
+
else
|
127
|
+
::Hash.from_bson(buffer, **options)
|
128
|
+
end
|
129
|
+
new(javascript, scope)
|
124
130
|
end
|
125
131
|
|
126
132
|
# Register this type when the module is loaded.
|
data/lib/bson/db_pointer.rb
CHANGED
@@ -95,7 +95,13 @@ module BSON
|
|
95
95
|
#
|
96
96
|
# @see http://bsonspec.org/#/specification
|
97
97
|
def self.from_bson(buffer, **options)
|
98
|
-
|
98
|
+
ref = buffer.get_string
|
99
|
+
id = if options.empty?
|
100
|
+
ObjectId.from_bson(buffer)
|
101
|
+
else
|
102
|
+
ObjectId.from_bson(buffer, **options)
|
103
|
+
end
|
104
|
+
new(ref, id)
|
99
105
|
end
|
100
106
|
|
101
107
|
# Register this type when the module is loaded.
|
data/lib/bson/ext_json.rb
CHANGED
@@ -251,13 +251,13 @@ module BSON
|
|
251
251
|
when '$date'
|
252
252
|
case value
|
253
253
|
when String
|
254
|
-
::Time.parse(value)
|
254
|
+
::Time.parse(value).utc
|
255
255
|
when Hash
|
256
256
|
unless value.keys.sort == %w($numberLong)
|
257
257
|
raise Error::ExtJSONParseError, "Invalid value for $date: #{value}"
|
258
258
|
end
|
259
259
|
sec, msec = value.values.first.to_i.divmod(1000)
|
260
|
-
::Time.at(sec, msec*1000)
|
260
|
+
::Time.at(sec, msec*1000).utc
|
261
261
|
else
|
262
262
|
raise Error::ExtJSONParseError, "Invalid value for $date: #{value}"
|
263
263
|
end
|
data/lib/bson/version.rb
CHANGED
@@ -50,14 +50,46 @@ describe "BSON::ExtJSON.parse" do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
context 'when input is a timestamp' do
|
53
|
+
context 'when input is a BSON timestamp' do
|
54
54
|
let(:input) { {'$timestamp' => {'t' => 12345, 'i' => 42}} }
|
55
55
|
|
56
|
-
it 'returns a
|
56
|
+
it 'returns a BSON::Timestamp instance' do
|
57
57
|
parsed.should == BSON::Timestamp.new(12345, 42)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
context 'when input is an ISO time' do
|
62
|
+
let(:input) { {'$date' => '1970-01-01T00:00:04Z'} }
|
63
|
+
|
64
|
+
it 'returns a Time instance ' do
|
65
|
+
parsed.should be_a(Time)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'returns a Time instance with correct value' do
|
69
|
+
parsed.should == Time.at(4)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'returns a Time instance in UTC' do
|
73
|
+
parsed.zone.should == 'UTC'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when input is a Unix timestamp' do
|
78
|
+
let(:input) { {'$date' => {'$numberLong' => '4000'}} }
|
79
|
+
|
80
|
+
it 'returns a Time instance ' do
|
81
|
+
parsed.should be_a(Time)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'returns a Time instance with correct value' do
|
85
|
+
parsed.should == Time.at(4)
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'returns a Time instance in UTC' do
|
89
|
+
parsed.zone.should == 'UTC'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
61
93
|
context 'when input is an int32' do
|
62
94
|
let(:input) do
|
63
95
|
{'$numberInt' => '42'}
|
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.8.
|
4
|
+
version: 4.8.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
gpvfPNWMwyBDlHaNS3GfO6cRRxBOvEG05GUCsvtTY4Bpe8yjE64wg1ymb47LMOnv
|
34
34
|
Qb1lGORmf/opg45mluKUYl7pQNZHD0d3
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date: 2020-03-
|
36
|
+
date: 2020-03-04 00:00:00.000000000 Z
|
37
37
|
dependencies: []
|
38
38
|
description: A fully featured BSON specification implementation in Ruby
|
39
39
|
email:
|
@@ -226,118 +226,118 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
version: 1.3.6
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.7.
|
229
|
+
rubygems_version: 2.7.9
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Ruby implementation of the BSON specification
|
233
233
|
test_files:
|
234
|
-
- spec/bson_spec.rb
|
235
234
|
- spec/spec_helper.rb
|
236
|
-
- spec/
|
235
|
+
- spec/bson_spec.rb
|
236
|
+
- spec/bson/date_spec.rb
|
237
|
+
- spec/bson/config_spec.rb
|
238
|
+
- spec/bson/int64_spec.rb
|
237
239
|
- spec/bson/undefined_spec.rb
|
238
|
-
- spec/bson/regexp_spec.rb
|
239
|
-
- spec/bson/decimal128_spec.rb
|
240
240
|
- spec/bson/code_spec.rb
|
241
|
-
- spec/bson/time_spec.rb
|
242
241
|
- spec/bson/object_spec.rb
|
243
|
-
- spec/bson/
|
242
|
+
- spec/bson/date_time_spec.rb
|
243
|
+
- spec/bson/raw_spec.rb
|
244
|
+
- spec/bson/min_key_spec.rb
|
245
|
+
- spec/bson/time_with_zone_spec.rb
|
246
|
+
- spec/bson/time_spec.rb
|
247
|
+
- spec/bson/hash_spec.rb
|
248
|
+
- spec/bson/ext_json_parse_spec.rb
|
249
|
+
- spec/bson/timestamp_spec.rb
|
250
|
+
- spec/bson/int32_spec.rb
|
251
|
+
- spec/bson/byte_buffer_spec.rb
|
252
|
+
- spec/bson/registry_spec.rb
|
253
|
+
- spec/bson/symbol_raw_spec.rb
|
254
|
+
- spec/bson/regexp_spec.rb
|
255
|
+
- spec/bson/byte_buffer_write_spec.rb
|
256
|
+
- spec/bson/symbol_spec.rb
|
244
257
|
- spec/bson/string_spec.rb
|
245
|
-
- spec/bson/byte_buffer_read_spec.rb
|
246
|
-
- spec/bson/config_spec.rb
|
247
|
-
- spec/bson/json_spec.rb
|
248
258
|
- spec/bson/boolean_spec.rb
|
249
|
-
- spec/bson/hash_spec.rb
|
250
259
|
- spec/bson/open_struct_spec.rb
|
251
|
-
- spec/bson/
|
260
|
+
- spec/bson/decimal128_spec.rb
|
261
|
+
- spec/bson/json_spec.rb
|
252
262
|
- spec/bson/array_spec.rb
|
253
263
|
- spec/bson/false_class_spec.rb
|
254
|
-
- spec/bson/symbol_raw_spec.rb
|
255
|
-
- spec/bson/binary_uuid_spec.rb
|
256
|
-
- spec/bson/ext_json_parse_spec.rb
|
257
264
|
- spec/bson/true_class_spec.rb
|
258
|
-
- spec/bson/date_spec.rb
|
259
|
-
- spec/bson/byte_buffer_write_spec.rb
|
260
|
-
- spec/bson/int64_spec.rb
|
261
|
-
- spec/bson/timestamp_spec.rb
|
262
|
-
- spec/bson/max_key_spec.rb
|
263
|
-
- spec/bson/raw_spec.rb
|
264
|
-
- spec/bson/byte_buffer_spec.rb
|
265
|
-
- spec/bson/document_spec.rb
|
266
|
-
- spec/bson/code_with_scope_spec.rb
|
267
|
-
- spec/bson/float_spec.rb
|
268
|
-
- spec/bson/time_with_zone_spec.rb
|
269
265
|
- spec/bson/binary_spec.rb
|
270
|
-
- spec/bson/
|
271
|
-
- spec/bson/symbol_spec.rb
|
272
|
-
- spec/bson/date_time_spec.rb
|
266
|
+
- spec/bson/binary_uuid_spec.rb
|
273
267
|
- spec/bson/object_id_spec.rb
|
274
|
-
- spec/bson/
|
268
|
+
- spec/bson/code_with_scope_spec.rb
|
269
|
+
- spec/bson/nil_class_spec.rb
|
270
|
+
- spec/bson/integer_spec.rb
|
271
|
+
- spec/bson/document_spec.rb
|
272
|
+
- spec/bson/max_key_spec.rb
|
273
|
+
- spec/bson/byte_buffer_read_spec.rb
|
274
|
+
- spec/bson/float_spec.rb
|
275
275
|
- spec/support/utils.rb
|
276
276
|
- spec/support/shared_examples.rb
|
277
277
|
- spec/support/spec_config.rb
|
278
|
+
- spec/spec_tests/common_driver_spec.rb
|
278
279
|
- spec/spec_tests/corpus_spec.rb
|
279
280
|
- spec/spec_tests/corpus_legacy_spec.rb
|
280
|
-
- spec/spec_tests/
|
281
|
-
- spec/spec_tests/data/decimal128/decimal128-
|
281
|
+
- spec/spec_tests/data/decimal128/decimal128-4.json
|
282
|
+
- spec/spec_tests/data/decimal128/decimal128-2.json
|
283
|
+
- spec/spec_tests/data/decimal128/decimal128-5.json
|
282
284
|
- spec/spec_tests/data/decimal128/decimal128-3.json
|
285
|
+
- spec/spec_tests/data/decimal128/decimal128-6.json
|
283
286
|
- spec/spec_tests/data/decimal128/decimal128-1.json
|
284
|
-
- spec/spec_tests/data/decimal128/decimal128-4.json
|
285
287
|
- spec/spec_tests/data/decimal128/decimal128-7.json
|
286
|
-
- spec/spec_tests/data/
|
287
|
-
- spec/spec_tests/data/decimal128/decimal128-2.json
|
288
|
-
- spec/spec_tests/data/corpus_legacy/code_w_scope.json
|
289
|
-
- spec/spec_tests/data/corpus_legacy/undefined.json
|
290
|
-
- spec/spec_tests/data/corpus_legacy/code.json
|
291
|
-
- spec/spec_tests/data/corpus_legacy/oid.json
|
292
|
-
- spec/spec_tests/data/corpus_legacy/timestamp.json
|
293
|
-
- spec/spec_tests/data/corpus_legacy/string.json
|
294
|
-
- spec/spec_tests/data/corpus_legacy/binary.json
|
295
|
-
- spec/spec_tests/data/corpus_legacy/null.json
|
296
|
-
- spec/spec_tests/data/corpus_legacy/int32.json
|
297
|
-
- spec/spec_tests/data/corpus_legacy/maxkey.json
|
298
|
-
- spec/spec_tests/data/corpus_legacy/array.json
|
299
|
-
- spec/spec_tests/data/corpus_legacy/regex.json
|
300
|
-
- spec/spec_tests/data/corpus_legacy/minkey.json
|
301
|
-
- spec/spec_tests/data/corpus_legacy/top.json
|
302
|
-
- spec/spec_tests/data/corpus_legacy/boolean.json
|
303
|
-
- spec/spec_tests/data/corpus_legacy/double.json
|
304
|
-
- spec/spec_tests/data/corpus_legacy/document.json
|
305
|
-
- spec/spec_tests/data/corpus_legacy/failures/symbol.json
|
306
|
-
- spec/spec_tests/data/corpus_legacy/failures/int64.json
|
307
|
-
- spec/spec_tests/data/corpus_legacy/failures/dbpointer.json
|
308
|
-
- spec/spec_tests/data/corpus_legacy/failures/datetime.json
|
309
|
-
- spec/spec_tests/data/corpus/code_w_scope.json
|
310
|
-
- spec/spec_tests/data/corpus/undefined.json
|
311
|
-
- spec/spec_tests/data/corpus/code.json
|
312
|
-
- spec/spec_tests/data/corpus/decimal128-6.json
|
313
|
-
- spec/spec_tests/data/corpus/oid.json
|
314
|
-
- spec/spec_tests/data/corpus/timestamp.json
|
315
|
-
- spec/spec_tests/data/corpus/decimal128-3.json
|
288
|
+
- spec/spec_tests/data/corpus/multi-type.json
|
316
289
|
- spec/spec_tests/data/corpus/string.json
|
290
|
+
- spec/spec_tests/data/corpus/decimal128-4.json
|
291
|
+
- spec/spec_tests/data/corpus/README.md
|
317
292
|
- spec/spec_tests/data/corpus/binary.json
|
293
|
+
- spec/spec_tests/data/corpus/decimal128-2.json
|
294
|
+
- spec/spec_tests/data/corpus/dbpointer.json
|
295
|
+
- spec/spec_tests/data/corpus/dbref.json
|
318
296
|
- spec/spec_tests/data/corpus/null.json
|
319
297
|
- spec/spec_tests/data/corpus/int32.json
|
320
|
-
- spec/spec_tests/data/corpus/multi-type.json
|
321
|
-
- spec/spec_tests/data/corpus/decimal128-1.json
|
322
|
-
- spec/spec_tests/data/corpus/decimal128-4.json
|
323
|
-
- spec/spec_tests/data/corpus/README.md
|
324
298
|
- spec/spec_tests/data/corpus/maxkey.json
|
325
|
-
- spec/spec_tests/data/corpus/
|
299
|
+
- spec/spec_tests/data/corpus/timestamp.json
|
300
|
+
- spec/spec_tests/data/corpus/multi-type-deprecated.json
|
301
|
+
- spec/spec_tests/data/corpus/code.json
|
302
|
+
- spec/spec_tests/data/corpus/document.json
|
303
|
+
- spec/spec_tests/data/corpus/double.json
|
304
|
+
- spec/spec_tests/data/corpus/decimal128-5.json
|
326
305
|
- spec/spec_tests/data/corpus/regex.json
|
327
|
-
- spec/spec_tests/data/corpus/dbref.json
|
328
306
|
- spec/spec_tests/data/corpus/symbol.json
|
329
|
-
- spec/spec_tests/data/corpus/
|
330
|
-
- spec/spec_tests/data/corpus/decimal128-
|
307
|
+
- spec/spec_tests/data/corpus/decimal128-3.json
|
308
|
+
- spec/spec_tests/data/corpus/decimal128-6.json
|
309
|
+
- spec/spec_tests/data/corpus/oid.json
|
331
310
|
- spec/spec_tests/data/corpus/top.json
|
332
|
-
- spec/spec_tests/data/corpus/decimal128-
|
311
|
+
- spec/spec_tests/data/corpus/decimal128-1.json
|
333
312
|
- spec/spec_tests/data/corpus/boolean.json
|
334
|
-
- spec/spec_tests/data/corpus/
|
335
|
-
- spec/spec_tests/data/corpus/
|
336
|
-
- spec/spec_tests/data/corpus/
|
337
|
-
- spec/spec_tests/data/corpus/
|
338
|
-
- spec/spec_tests/data/corpus/
|
339
|
-
- spec/spec_tests/data/corpus/document.json
|
313
|
+
- spec/spec_tests/data/corpus/decimal128-7.json
|
314
|
+
- spec/spec_tests/data/corpus/array.json
|
315
|
+
- spec/spec_tests/data/corpus/code_w_scope.json
|
316
|
+
- spec/spec_tests/data/corpus/undefined.json
|
317
|
+
- spec/spec_tests/data/corpus/minkey.json
|
340
318
|
- spec/spec_tests/data/corpus/datetime.json
|
341
|
-
- spec/
|
342
|
-
- spec/
|
319
|
+
- spec/spec_tests/data/corpus/int64.json
|
320
|
+
- spec/spec_tests/data/corpus_legacy/string.json
|
321
|
+
- spec/spec_tests/data/corpus_legacy/binary.json
|
322
|
+
- spec/spec_tests/data/corpus_legacy/null.json
|
323
|
+
- spec/spec_tests/data/corpus_legacy/int32.json
|
324
|
+
- spec/spec_tests/data/corpus_legacy/maxkey.json
|
325
|
+
- spec/spec_tests/data/corpus_legacy/timestamp.json
|
326
|
+
- spec/spec_tests/data/corpus_legacy/code.json
|
327
|
+
- spec/spec_tests/data/corpus_legacy/document.json
|
328
|
+
- spec/spec_tests/data/corpus_legacy/double.json
|
329
|
+
- spec/spec_tests/data/corpus_legacy/regex.json
|
330
|
+
- spec/spec_tests/data/corpus_legacy/oid.json
|
331
|
+
- spec/spec_tests/data/corpus_legacy/top.json
|
332
|
+
- spec/spec_tests/data/corpus_legacy/boolean.json
|
333
|
+
- spec/spec_tests/data/corpus_legacy/array.json
|
334
|
+
- spec/spec_tests/data/corpus_legacy/code_w_scope.json
|
335
|
+
- spec/spec_tests/data/corpus_legacy/undefined.json
|
336
|
+
- spec/spec_tests/data/corpus_legacy/minkey.json
|
337
|
+
- spec/spec_tests/data/corpus_legacy/failures/dbpointer.json
|
338
|
+
- spec/spec_tests/data/corpus_legacy/failures/symbol.json
|
339
|
+
- spec/spec_tests/data/corpus_legacy/failures/datetime.json
|
340
|
+
- spec/spec_tests/data/corpus_legacy/failures/int64.json
|
343
341
|
- spec/runners/corpus.rb
|
342
|
+
- spec/runners/common_driver.rb
|
343
|
+
- spec/runners/corpus_legacy.rb
|
metadata.gz.sig
CHANGED
Binary file
|