bson 5.0.2 → 5.1.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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -0
  3. data/ext/bson/extconf.rb +1 -1
  4. data/lib/bson/binary.rb +126 -4
  5. data/lib/bson/document.rb +8 -0
  6. data/lib/bson/object_id.rb +1 -1
  7. data/lib/bson/regexp.rb +3 -3
  8. data/lib/bson/vector.rb +44 -0
  9. data/lib/bson/version.rb +5 -16
  10. data/lib/bson.rb +1 -0
  11. data/spec/bson/document_as_spec.rb +14 -0
  12. data/spec/bson/vector_spec.rb +33 -0
  13. data/spec/runners/binary_vector.rb +78 -0
  14. data/spec/shared/LICENSE +20 -0
  15. data/spec/shared/bin/get-mongodb-download-url +17 -0
  16. data/spec/shared/bin/s3-copy +45 -0
  17. data/spec/shared/bin/s3-upload +69 -0
  18. data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
  19. data/spec/shared/lib/mrss/cluster_config.rb +231 -0
  20. data/spec/shared/lib/mrss/constraints.rb +378 -0
  21. data/spec/shared/lib/mrss/docker_runner.rb +298 -0
  22. data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
  23. data/spec/shared/lib/mrss/event_subscriber.rb +210 -0
  24. data/spec/shared/lib/mrss/lite_constraints.rb +238 -0
  25. data/spec/shared/lib/mrss/release/candidate.rb +284 -0
  26. data/spec/shared/lib/mrss/release/product_data.rb +144 -0
  27. data/spec/shared/lib/mrss/server_version_registry.rb +113 -0
  28. data/spec/shared/lib/mrss/session_registry.rb +69 -0
  29. data/spec/shared/lib/mrss/session_registry_legacy.rb +60 -0
  30. data/spec/shared/lib/mrss/spec_organizer.rb +179 -0
  31. data/spec/shared/lib/mrss/utils.rb +37 -0
  32. data/spec/shared/lib/tasks/candidate.rake +64 -0
  33. data/spec/shared/share/Dockerfile.erb +251 -0
  34. data/spec/shared/share/haproxy-1.conf +16 -0
  35. data/spec/shared/share/haproxy-2.conf +17 -0
  36. data/spec/shared/shlib/config.sh +27 -0
  37. data/spec/shared/shlib/distro.sh +84 -0
  38. data/spec/shared/shlib/server.sh +423 -0
  39. data/spec/shared/shlib/set_env.sh +110 -0
  40. data/spec/spec_helper.rb +2 -0
  41. data/spec/spec_tests/binary_vector_spec.rb +82 -0
  42. data/spec/spec_tests/data/binary_vector/README.md +61 -0
  43. data/spec/spec_tests/data/binary_vector/float32.json +65 -0
  44. data/spec/spec_tests/data/binary_vector/int8.json +57 -0
  45. data/spec/spec_tests/data/binary_vector/packed_bit.json +83 -0
  46. data/spec/spec_tests/data/corpus/binary.json +30 -0
  47. metadata +70 -6
@@ -0,0 +1,65 @@
1
+ {
2
+ "description": "Tests of Binary subtype 9, Vectors, with dtype FLOAT32",
3
+ "test_key": "vector",
4
+ "tests": [
5
+ {
6
+ "description": "Simple Vector FLOAT32",
7
+ "valid": true,
8
+ "vector": [127.0, 7.0],
9
+ "dtype_hex": "0x27",
10
+ "dtype_alias": "FLOAT32",
11
+ "padding": 0,
12
+ "canonical_bson": "1C00000005766563746F72000A0000000927000000FE420000E04000"
13
+ },
14
+ {
15
+ "description": "Vector with decimals and negative value FLOAT32",
16
+ "valid": true,
17
+ "vector": [127.7, -7.7],
18
+ "dtype_hex": "0x27",
19
+ "dtype_alias": "FLOAT32",
20
+ "padding": 0,
21
+ "canonical_bson": "1C00000005766563746F72000A0000000927006666FF426666F6C000"
22
+ },
23
+ {
24
+ "description": "Empty Vector FLOAT32",
25
+ "valid": true,
26
+ "vector": [],
27
+ "dtype_hex": "0x27",
28
+ "dtype_alias": "FLOAT32",
29
+ "padding": 0,
30
+ "canonical_bson": "1400000005766563746F72000200000009270000"
31
+ },
32
+ {
33
+ "description": "Infinity Vector FLOAT32",
34
+ "valid": true,
35
+ "vector": [{"$numberDouble": "-Infinity"}, 0.0, {"$numberDouble": "Infinity"} ],
36
+ "dtype_hex": "0x27",
37
+ "dtype_alias": "FLOAT32",
38
+ "padding": 0,
39
+ "canonical_bson": "2000000005766563746F72000E000000092700000080FF000000000000807F00"
40
+ },
41
+ {
42
+ "description": "FLOAT32 with padding",
43
+ "valid": false,
44
+ "vector": [127.0, 7.0],
45
+ "dtype_hex": "0x27",
46
+ "dtype_alias": "FLOAT32",
47
+ "padding": 3,
48
+ "canonical_bson": "1C00000005766563746F72000A0000000927030000FE420000E04000"
49
+ },
50
+ {
51
+ "description": "Insufficient vector data with 3 bytes FLOAT32",
52
+ "valid": false,
53
+ "dtype_hex": "0x27",
54
+ "dtype_alias": "FLOAT32",
55
+ "canonical_bson": "1700000005766563746F7200050000000927002A2A2A00"
56
+ },
57
+ {
58
+ "description": "Insufficient vector data with 5 bytes FLOAT32",
59
+ "valid": false,
60
+ "dtype_hex": "0x27",
61
+ "dtype_alias": "FLOAT32",
62
+ "canonical_bson": "1900000005766563746F7200070000000927002A2A2A2A2A00"
63
+ }
64
+ ]
65
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "description": "Tests of Binary subtype 9, Vectors, with dtype INT8",
3
+ "test_key": "vector",
4
+ "tests": [
5
+ {
6
+ "description": "Simple Vector INT8",
7
+ "valid": true,
8
+ "vector": [127, 7],
9
+ "dtype_hex": "0x03",
10
+ "dtype_alias": "INT8",
11
+ "padding": 0,
12
+ "canonical_bson": "1600000005766563746F7200040000000903007F0700"
13
+ },
14
+ {
15
+ "description": "Empty Vector INT8",
16
+ "valid": true,
17
+ "vector": [],
18
+ "dtype_hex": "0x03",
19
+ "dtype_alias": "INT8",
20
+ "padding": 0,
21
+ "canonical_bson": "1400000005766563746F72000200000009030000"
22
+ },
23
+ {
24
+ "description": "Overflow Vector INT8",
25
+ "valid": false,
26
+ "vector": [128],
27
+ "dtype_hex": "0x03",
28
+ "dtype_alias": "INT8",
29
+ "padding": 0
30
+ },
31
+ {
32
+ "description": "Underflow Vector INT8",
33
+ "valid": false,
34
+ "vector": [-129],
35
+ "dtype_hex": "0x03",
36
+ "dtype_alias": "INT8",
37
+ "padding": 0
38
+ },
39
+ {
40
+ "description": "INT8 with padding",
41
+ "valid": false,
42
+ "vector": [127, 7],
43
+ "dtype_hex": "0x03",
44
+ "dtype_alias": "INT8",
45
+ "padding": 3,
46
+ "canonical_bson": "1600000005766563746F7200040000000903037F0700"
47
+ },
48
+ {
49
+ "description": "INT8 with float inputs",
50
+ "valid": false,
51
+ "vector": [127.77, 7.77],
52
+ "dtype_hex": "0x03",
53
+ "dtype_alias": "INT8",
54
+ "padding": 0
55
+ }
56
+ ]
57
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "description": "Tests of Binary subtype 9, Vectors, with dtype PACKED_BIT",
3
+ "test_key": "vector",
4
+ "tests": [
5
+ {
6
+ "description": "Padding specified with no vector data PACKED_BIT",
7
+ "valid": false,
8
+ "vector": [],
9
+ "dtype_hex": "0x10",
10
+ "dtype_alias": "PACKED_BIT",
11
+ "padding": 1,
12
+ "canonical_bson": "1400000005766563746F72000200000009100100"
13
+ },
14
+ {
15
+ "description": "Simple Vector PACKED_BIT",
16
+ "valid": true,
17
+ "vector": [127, 7],
18
+ "dtype_hex": "0x10",
19
+ "dtype_alias": "PACKED_BIT",
20
+ "padding": 0,
21
+ "canonical_bson": "1600000005766563746F7200040000000910007F0700"
22
+ },
23
+ {
24
+ "description": "Empty Vector PACKED_BIT",
25
+ "valid": true,
26
+ "vector": [],
27
+ "dtype_hex": "0x10",
28
+ "dtype_alias": "PACKED_BIT",
29
+ "padding": 0,
30
+ "canonical_bson": "1400000005766563746F72000200000009100000"
31
+ },
32
+ {
33
+ "description": "PACKED_BIT with padding",
34
+ "valid": true,
35
+ "vector": [127, 7],
36
+ "dtype_hex": "0x10",
37
+ "dtype_alias": "PACKED_BIT",
38
+ "padding": 3,
39
+ "canonical_bson": "1600000005766563746F7200040000000910037F0700"
40
+ },
41
+ {
42
+ "description": "Overflow Vector PACKED_BIT",
43
+ "valid": false,
44
+ "vector": [256],
45
+ "dtype_hex": "0x10",
46
+ "dtype_alias": "PACKED_BIT",
47
+ "padding": 0
48
+ },
49
+ {
50
+ "description": "Underflow Vector PACKED_BIT",
51
+ "valid": false,
52
+ "vector": [-1],
53
+ "dtype_hex": "0x10",
54
+ "dtype_alias": "PACKED_BIT",
55
+ "padding": 0
56
+ },
57
+ {
58
+ "description": "Vector with float values PACKED_BIT",
59
+ "valid": false,
60
+ "vector": [127.5],
61
+ "dtype_hex": "0x10",
62
+ "dtype_alias": "PACKED_BIT",
63
+ "padding": 0
64
+ },
65
+ {
66
+ "description": "Exceeding maximum padding PACKED_BIT",
67
+ "valid": false,
68
+ "vector": [1],
69
+ "dtype_hex": "0x10",
70
+ "dtype_alias": "PACKED_BIT",
71
+ "padding": 8,
72
+ "canonical_bson": "1500000005766563746F7200030000000910080100"
73
+ },
74
+ {
75
+ "description": "Negative padding PACKED_BIT",
76
+ "valid": false,
77
+ "vector": [1],
78
+ "dtype_hex": "0x10",
79
+ "dtype_alias": "PACKED_BIT",
80
+ "padding": -1
81
+ }
82
+ ]
83
+ }
@@ -74,6 +74,36 @@
74
74
  "description": "$type query operator (conflicts with legacy $binary form with $type field)",
75
75
  "canonical_bson": "180000000378001000000010247479706500020000000000",
76
76
  "canonical_extjson": "{\"x\" : { \"$type\" : {\"$numberInt\": \"2\"}}}"
77
+ },
78
+ {
79
+ "description": "subtype 0x09 Vector FLOAT32",
80
+ "canonical_bson": "170000000578000A0000000927000000FE420000E04000",
81
+ "canonical_extjson": "{\"x\": {\"$binary\": {\"base64\": \"JwAAAP5CAADgQA==\", \"subType\": \"09\"}}}"
82
+ },
83
+ {
84
+ "description": "subtype 0x09 Vector INT8",
85
+ "canonical_bson": "11000000057800040000000903007F0700",
86
+ "canonical_extjson": "{\"x\": {\"$binary\": {\"base64\": \"AwB/Bw==\", \"subType\": \"09\"}}}"
87
+ },
88
+ {
89
+ "description": "subtype 0x09 Vector PACKED_BIT",
90
+ "canonical_bson": "11000000057800040000000910007F0700",
91
+ "canonical_extjson": "{\"x\": {\"$binary\": {\"base64\": \"EAB/Bw==\", \"subType\": \"09\"}}}"
92
+ },
93
+ {
94
+ "description": "subtype 0x09 Vector (Zero-length) FLOAT32",
95
+ "canonical_bson": "0F0000000578000200000009270000",
96
+ "canonical_extjson": "{\"x\": {\"$binary\": {\"base64\": \"JwA=\", \"subType\": \"09\"}}}"
97
+ },
98
+ {
99
+ "description": "subtype 0x09 Vector (Zero-length) INT8",
100
+ "canonical_bson": "0F0000000578000200000009030000",
101
+ "canonical_extjson": "{\"x\": {\"$binary\": {\"base64\": \"AwA=\", \"subType\": \"09\"}}}"
102
+ },
103
+ {
104
+ "description": "subtype 0x09 Vector (Zero-length) PACKED_BIT",
105
+ "canonical_bson": "0F0000000578000200000009100000",
106
+ "canonical_extjson": "{\"x\": {\"$binary\": {\"base64\": \"EAA=\", \"subType\": \"09\"}}}"
77
107
  }
78
108
  ],
79
109
  "decodeErrors": [
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MongoDB Ruby Team
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: A fully featured BSON specification implementation in Ruby
14
13
  email: dbx-ruby@mongodb.com
@@ -90,6 +89,7 @@ files:
90
89
  - lib/bson/timestamp.rb
91
90
  - lib/bson/true_class.rb
92
91
  - lib/bson/undefined.rb
92
+ - lib/bson/vector.rb
93
93
  - lib/bson/version.rb
94
94
  - spec/README.md
95
95
  - spec/bson/array_spec.rb
@@ -136,14 +136,47 @@ files:
136
136
  - spec/bson/timestamp_spec.rb
137
137
  - spec/bson/true_class_spec.rb
138
138
  - spec/bson/undefined_spec.rb
139
+ - spec/bson/vector_spec.rb
139
140
  - spec/bson_spec.rb
141
+ - spec/runners/binary_vector.rb
140
142
  - spec/runners/common_driver.rb
141
143
  - spec/runners/corpus.rb
142
144
  - spec/runners/corpus_legacy.rb
145
+ - spec/shared/LICENSE
146
+ - spec/shared/bin/get-mongodb-download-url
147
+ - spec/shared/bin/s3-copy
148
+ - spec/shared/bin/s3-upload
149
+ - spec/shared/lib/mrss/child_process_helper.rb
150
+ - spec/shared/lib/mrss/cluster_config.rb
151
+ - spec/shared/lib/mrss/constraints.rb
152
+ - spec/shared/lib/mrss/docker_runner.rb
153
+ - spec/shared/lib/mrss/eg_config_utils.rb
154
+ - spec/shared/lib/mrss/event_subscriber.rb
155
+ - spec/shared/lib/mrss/lite_constraints.rb
156
+ - spec/shared/lib/mrss/release/candidate.rb
157
+ - spec/shared/lib/mrss/release/product_data.rb
158
+ - spec/shared/lib/mrss/server_version_registry.rb
159
+ - spec/shared/lib/mrss/session_registry.rb
160
+ - spec/shared/lib/mrss/session_registry_legacy.rb
161
+ - spec/shared/lib/mrss/spec_organizer.rb
162
+ - spec/shared/lib/mrss/utils.rb
163
+ - spec/shared/lib/tasks/candidate.rake
164
+ - spec/shared/share/Dockerfile.erb
165
+ - spec/shared/share/haproxy-1.conf
166
+ - spec/shared/share/haproxy-2.conf
167
+ - spec/shared/shlib/config.sh
168
+ - spec/shared/shlib/distro.sh
169
+ - spec/shared/shlib/server.sh
170
+ - spec/shared/shlib/set_env.sh
143
171
  - spec/spec_helper.rb
172
+ - spec/spec_tests/binary_vector_spec.rb
144
173
  - spec/spec_tests/common_driver_spec.rb
145
174
  - spec/spec_tests/corpus_legacy_spec.rb
146
175
  - spec/spec_tests/corpus_spec.rb
176
+ - spec/spec_tests/data/binary_vector/README.md
177
+ - spec/spec_tests/data/binary_vector/float32.json
178
+ - spec/spec_tests/data/binary_vector/int8.json
179
+ - spec/spec_tests/data/binary_vector/packed_bit.json
147
180
  - spec/spec_tests/data/corpus/README.md
148
181
  - spec/spec_tests/data/corpus/array.json
149
182
  - spec/spec_tests/data/corpus/binary.json
@@ -216,7 +249,6 @@ metadata:
216
249
  documentation_uri: https://www.mongodb.com/docs/ruby-driver/current/tutorials/bson-v4/
217
250
  homepage_uri: https://www.mongodb.com/docs/ruby-driver/current/tutorials/bson-v4/
218
251
  source_code_uri: https://github.com/mongodb/bson-ruby
219
- post_install_message:
220
252
  rdoc_options: []
221
253
  require_paths:
222
254
  - lib
@@ -231,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
263
  - !ruby/object:Gem::Version
232
264
  version: 1.3.6
233
265
  requirements: []
234
- rubygems_version: 3.4.19
235
- signing_key:
266
+ rubygems_version: 3.6.9
236
267
  specification_version: 4
237
268
  summary: Ruby implementation of the BSON specification
238
269
  test_files:
@@ -281,14 +312,47 @@ test_files:
281
312
  - spec/bson/timestamp_spec.rb
282
313
  - spec/bson/true_class_spec.rb
283
314
  - spec/bson/undefined_spec.rb
315
+ - spec/bson/vector_spec.rb
284
316
  - spec/bson_spec.rb
317
+ - spec/runners/binary_vector.rb
285
318
  - spec/runners/common_driver.rb
286
319
  - spec/runners/corpus.rb
287
320
  - spec/runners/corpus_legacy.rb
321
+ - spec/shared/LICENSE
322
+ - spec/shared/bin/get-mongodb-download-url
323
+ - spec/shared/bin/s3-copy
324
+ - spec/shared/bin/s3-upload
325
+ - spec/shared/lib/mrss/child_process_helper.rb
326
+ - spec/shared/lib/mrss/cluster_config.rb
327
+ - spec/shared/lib/mrss/constraints.rb
328
+ - spec/shared/lib/mrss/docker_runner.rb
329
+ - spec/shared/lib/mrss/eg_config_utils.rb
330
+ - spec/shared/lib/mrss/event_subscriber.rb
331
+ - spec/shared/lib/mrss/lite_constraints.rb
332
+ - spec/shared/lib/mrss/release/candidate.rb
333
+ - spec/shared/lib/mrss/release/product_data.rb
334
+ - spec/shared/lib/mrss/server_version_registry.rb
335
+ - spec/shared/lib/mrss/session_registry.rb
336
+ - spec/shared/lib/mrss/session_registry_legacy.rb
337
+ - spec/shared/lib/mrss/spec_organizer.rb
338
+ - spec/shared/lib/mrss/utils.rb
339
+ - spec/shared/lib/tasks/candidate.rake
340
+ - spec/shared/share/Dockerfile.erb
341
+ - spec/shared/share/haproxy-1.conf
342
+ - spec/shared/share/haproxy-2.conf
343
+ - spec/shared/shlib/config.sh
344
+ - spec/shared/shlib/distro.sh
345
+ - spec/shared/shlib/server.sh
346
+ - spec/shared/shlib/set_env.sh
288
347
  - spec/spec_helper.rb
348
+ - spec/spec_tests/binary_vector_spec.rb
289
349
  - spec/spec_tests/common_driver_spec.rb
290
350
  - spec/spec_tests/corpus_legacy_spec.rb
291
351
  - spec/spec_tests/corpus_spec.rb
352
+ - spec/spec_tests/data/binary_vector/README.md
353
+ - spec/spec_tests/data/binary_vector/float32.json
354
+ - spec/spec_tests/data/binary_vector/int8.json
355
+ - spec/spec_tests/data/binary_vector/packed_bit.json
292
356
  - spec/spec_tests/data/corpus/README.md
293
357
  - spec/spec_tests/data/corpus/array.json
294
358
  - spec/spec_tests/data/corpus/binary.json