bson 5.2.0-java → 5.2.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 +4 -4
- data/lib/bson/array.rb +13 -8
- data/lib/bson/binary.rb +14 -1
- data/lib/bson/db_pointer.rb +16 -0
- data/lib/bson/dbref.rb +0 -15
- data/lib/bson/environment.rb +0 -13
- data/lib/bson/ext_json.rb +33 -4
- data/lib/bson/float.rb +3 -0
- data/lib/bson/hash.rb +13 -8
- data/lib/bson/int32.rb +6 -0
- data/lib/bson/int64.rb +3 -0
- data/lib/bson/integer.rb +9 -0
- data/lib/bson/open_struct.rb +1 -5
- data/lib/bson/regexp.rb +0 -7
- data/lib/bson/string.rb +0 -5
- data/lib/bson/timestamp.rb +0 -1
- data/lib/bson/version.rb +1 -1
- data/lib/bson-ruby.jar +0 -0
- data/lib/bson.rb +34 -6
- data/spec/bson/array_spec.rb +24 -0
- data/spec/bson/binary_spec.rb +52 -0
- data/spec/bson/byte_buffer_write_spec.rb +15 -15
- data/spec/bson/date_spec.rb +2 -2
- data/spec/bson/date_time_spec.rb +2 -2
- data/spec/bson/db_pointer_spec.rb +163 -0
- data/spec/bson/decimal128_spec.rb +1 -1
- data/spec/bson/ext_json_parse_spec.rb +114 -0
- data/spec/bson/float_spec.rb +1 -1
- data/spec/bson/int32_spec.rb +4 -4
- data/spec/bson/int64_spec.rb +2 -2
- data/spec/bson/integer_spec.rb +2 -2
- data/spec/bson/max_nesting_depth_spec.rb +198 -0
- data/spec/bson/string_length_overflow_spec.rb +64 -0
- data/spec/bson/time_spec.rb +3 -3
- data/spec/bson/time_with_zone_spec.rb +2 -2
- data/spec/bson/timestamp_spec.rb +1 -1
- data/spec/bson_spec.rb +16 -4
- data/spec/support/pack_directives.rb +18 -0
- metadata +52 -3
- data/lib/bson/error/illegal_key.rb +0 -23
data/spec/bson_spec.rb
CHANGED
|
@@ -19,11 +19,23 @@ describe BSON do
|
|
|
19
19
|
|
|
20
20
|
describe ".ObjectId" do
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
context 'when given a string' do
|
|
23
|
+
let(:string) { "4e4d66343b39b68407000001" }
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
it "returns a BSON::ObjectId from given string" do
|
|
26
|
+
expect(described_class::ObjectId(string)).to be_a BSON::ObjectId
|
|
27
|
+
expect(described_class::ObjectId(string)).to eq BSON::ObjectId.from_string(string)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context 'when given an object id' do
|
|
32
|
+
let(:object_id) do
|
|
33
|
+
described_class::ObjectId.new
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'returns the same object' do
|
|
37
|
+
expect(described_class::ObjectId(object_id)).to be(object_id)
|
|
38
|
+
end
|
|
27
39
|
end
|
|
28
40
|
end
|
|
29
41
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Pack directives used by the test suite to build reference BSON encodings.
|
|
4
|
+
#
|
|
5
|
+
# These mirror the (now deprecated) BSON::Float::PACK, BSON::Int32::PACK, and
|
|
6
|
+
# BSON::Int64::PACK constants. The library no longer uses those constants
|
|
7
|
+
# internally, so the specs keep their own copies here rather than depending on
|
|
8
|
+
# deprecated production constants.
|
|
9
|
+
module PackDirectives
|
|
10
|
+
# Pack directive for 8 byte floating points.
|
|
11
|
+
FLOAT = 'E'
|
|
12
|
+
|
|
13
|
+
# Pack directive for little-endian 32 bit integers.
|
|
14
|
+
INT32 = 'l<'
|
|
15
|
+
|
|
16
|
+
# Pack directive for little-endian 64 bit integers.
|
|
17
|
+
INT64 = 'q<'
|
|
18
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,56 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bson
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.2.
|
|
4
|
+
version: 5.2.1
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- The MongoDB Ruby Team
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: base64
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: bigdecimal
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: ostruct
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
12
54
|
description: A fully featured BSON specification implementation in Ruby
|
|
13
55
|
email: dbx-ruby@mongodb.com
|
|
14
56
|
executables: []
|
|
@@ -42,7 +84,6 @@ files:
|
|
|
42
84
|
- lib/bson/error.rb
|
|
43
85
|
- lib/bson/error/bson_decode_error.rb
|
|
44
86
|
- lib/bson/error/ext_json_parse_error.rb
|
|
45
|
-
- lib/bson/error/illegal_key.rb
|
|
46
87
|
- lib/bson/error/invalid_binary_type.rb
|
|
47
88
|
- lib/bson/error/invalid_dbref_argument.rb
|
|
48
89
|
- lib/bson/error/invalid_decimal128_argument.rb
|
|
@@ -95,6 +136,7 @@ files:
|
|
|
95
136
|
- spec/bson/config_spec.rb
|
|
96
137
|
- spec/bson/date_spec.rb
|
|
97
138
|
- spec/bson/date_time_spec.rb
|
|
139
|
+
- spec/bson/db_pointer_spec.rb
|
|
98
140
|
- spec/bson/dbref_legacy_spec.rb
|
|
99
141
|
- spec/bson/dbref_spec.rb
|
|
100
142
|
- spec/bson/decimal128_spec.rb
|
|
@@ -110,6 +152,7 @@ files:
|
|
|
110
152
|
- spec/bson/integer_spec.rb
|
|
111
153
|
- spec/bson/json_spec.rb
|
|
112
154
|
- spec/bson/max_key_spec.rb
|
|
155
|
+
- spec/bson/max_nesting_depth_spec.rb
|
|
113
156
|
- spec/bson/min_key_spec.rb
|
|
114
157
|
- spec/bson/nil_class_spec.rb
|
|
115
158
|
- spec/bson/object_id_spec.rb
|
|
@@ -118,6 +161,7 @@ files:
|
|
|
118
161
|
- spec/bson/raw_spec.rb
|
|
119
162
|
- spec/bson/regexp_spec.rb
|
|
120
163
|
- spec/bson/registry_spec.rb
|
|
164
|
+
- spec/bson/string_length_overflow_spec.rb
|
|
121
165
|
- spec/bson/string_spec.rb
|
|
122
166
|
- spec/bson/symbol_raw_spec.rb
|
|
123
167
|
- spec/bson/symbol_spec.rb
|
|
@@ -227,6 +271,7 @@ files:
|
|
|
227
271
|
- spec/spec_tests/data/decimal128/decimal128-5.json
|
|
228
272
|
- spec/spec_tests/data/decimal128/decimal128-6.json
|
|
229
273
|
- spec/spec_tests/data/decimal128/decimal128-7.json
|
|
274
|
+
- spec/support/pack_directives.rb
|
|
230
275
|
- spec/support/shared_examples.rb
|
|
231
276
|
- spec/support/spec_config.rb
|
|
232
277
|
- spec/support/utils.rb
|
|
@@ -271,6 +316,7 @@ test_files:
|
|
|
271
316
|
- spec/bson/config_spec.rb
|
|
272
317
|
- spec/bson/date_spec.rb
|
|
273
318
|
- spec/bson/date_time_spec.rb
|
|
319
|
+
- spec/bson/db_pointer_spec.rb
|
|
274
320
|
- spec/bson/dbref_legacy_spec.rb
|
|
275
321
|
- spec/bson/dbref_spec.rb
|
|
276
322
|
- spec/bson/decimal128_spec.rb
|
|
@@ -286,6 +332,7 @@ test_files:
|
|
|
286
332
|
- spec/bson/integer_spec.rb
|
|
287
333
|
- spec/bson/json_spec.rb
|
|
288
334
|
- spec/bson/max_key_spec.rb
|
|
335
|
+
- spec/bson/max_nesting_depth_spec.rb
|
|
289
336
|
- spec/bson/min_key_spec.rb
|
|
290
337
|
- spec/bson/nil_class_spec.rb
|
|
291
338
|
- spec/bson/object_id_spec.rb
|
|
@@ -294,6 +341,7 @@ test_files:
|
|
|
294
341
|
- spec/bson/raw_spec.rb
|
|
295
342
|
- spec/bson/regexp_spec.rb
|
|
296
343
|
- spec/bson/registry_spec.rb
|
|
344
|
+
- spec/bson/string_length_overflow_spec.rb
|
|
297
345
|
- spec/bson/string_spec.rb
|
|
298
346
|
- spec/bson/symbol_raw_spec.rb
|
|
299
347
|
- spec/bson/symbol_spec.rb
|
|
@@ -403,6 +451,7 @@ test_files:
|
|
|
403
451
|
- spec/spec_tests/data/decimal128/decimal128-5.json
|
|
404
452
|
- spec/spec_tests/data/decimal128/decimal128-6.json
|
|
405
453
|
- spec/spec_tests/data/decimal128/decimal128-7.json
|
|
454
|
+
- spec/support/pack_directives.rb
|
|
406
455
|
- spec/support/shared_examples.rb
|
|
407
456
|
- spec/support/spec_config.rb
|
|
408
457
|
- spec/support/utils.rb
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# rubocop:todo all
|
|
3
|
-
|
|
4
|
-
module BSON
|
|
5
|
-
class Error
|
|
6
|
-
|
|
7
|
-
# Raised when validating keys and a key is illegal in MongoDB
|
|
8
|
-
class IllegalKey < Error
|
|
9
|
-
|
|
10
|
-
# Instantiate the exception.
|
|
11
|
-
#
|
|
12
|
-
# @example Instantiate the exception.
|
|
13
|
-
# BSON::Error::IllegalKey.new(string)
|
|
14
|
-
#
|
|
15
|
-
# @param [ String ] string The illegal string.
|
|
16
|
-
#
|
|
17
|
-
# @api private
|
|
18
|
-
def initialize(string)
|
|
19
|
-
super("'#{string}' is an illegal key in MongoDB. Keys may not start with '$' or contain a '.'.")
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|