bson 4.2.2 → 4.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +25 -7
- data/Rakefile +16 -9
- data/ext/bson/{native-endian.h → bson-endian.h} +5 -99
- data/ext/bson/bson-native.h +125 -0
- data/ext/bson/bytebuf.c +133 -0
- data/ext/bson/endian.c +117 -0
- data/ext/bson/init.c +355 -0
- data/ext/bson/libbson-utf8.c +230 -0
- data/ext/bson/read.c +411 -0
- data/ext/bson/util.c +95 -0
- data/ext/bson/write.c +680 -0
- data/lib/bson.rb +6 -3
- data/lib/bson/active_support.rb +17 -0
- data/lib/bson/array.rb +57 -17
- data/lib/bson/binary.rb +185 -13
- data/lib/bson/boolean.rb +12 -3
- data/lib/bson/code.rb +16 -2
- data/lib/bson/code_with_scope.rb +32 -5
- data/lib/bson/config.rb +1 -1
- data/lib/bson/date.rb +12 -2
- data/lib/bson/date_time.rb +2 -2
- data/lib/bson/db_pointer.rb +110 -0
- data/lib/bson/decimal128.rb +17 -3
- data/lib/bson/decimal128/builder.rb +1 -1
- data/lib/bson/document.rb +152 -5
- data/lib/bson/environment.rb +2 -1
- data/lib/bson/error.rb +27 -0
- data/lib/bson/ext_json.rb +383 -0
- data/lib/bson/false_class.rb +1 -1
- data/lib/bson/float.rb +48 -2
- data/lib/bson/hash.rb +68 -17
- data/lib/bson/int32.rb +52 -13
- data/lib/bson/int64.rb +59 -15
- data/lib/bson/integer.rb +36 -2
- data/lib/bson/json.rb +1 -1
- data/lib/bson/max_key.rb +13 -1
- data/lib/bson/min_key.rb +13 -1
- data/lib/bson/nil_class.rb +4 -2
- data/lib/bson/object.rb +28 -1
- data/lib/bson/object_id.rb +16 -2
- data/lib/bson/open_struct.rb +1 -1
- data/lib/bson/regexp.rb +27 -4
- data/lib/bson/registry.rb +3 -3
- data/lib/bson/specialized.rb +4 -2
- data/lib/bson/string.rb +5 -3
- data/lib/bson/symbol.rb +99 -7
- data/lib/bson/time.rb +63 -4
- data/lib/bson/time_with_zone.rb +54 -0
- data/lib/bson/timestamp.rb +44 -6
- data/lib/bson/true_class.rb +1 -1
- data/lib/bson/undefined.rb +12 -1
- data/lib/bson/version.rb +2 -2
- data/spec/bson/array_spec.rb +18 -1
- data/spec/bson/binary_spec.rb +100 -3
- data/spec/bson/binary_uuid_spec.rb +189 -0
- data/spec/bson/boolean_spec.rb +1 -1
- data/spec/bson/byte_buffer_read_spec.rb +197 -0
- data/spec/bson/byte_buffer_spec.rb +121 -381
- data/spec/bson/byte_buffer_write_spec.rb +854 -0
- data/spec/bson/code_spec.rb +1 -1
- data/spec/bson/code_with_scope_spec.rb +1 -1
- data/spec/bson/date_spec.rb +1 -1
- data/spec/bson/date_time_spec.rb +54 -1
- data/spec/bson/decimal128_spec.rb +35 -35
- data/spec/bson/document_as_spec.rb +46 -0
- data/spec/bson/document_spec.rb +197 -30
- data/spec/bson/ext_json_parse_spec.rb +308 -0
- data/spec/bson/false_class_spec.rb +1 -1
- data/spec/bson/float_spec.rb +37 -1
- data/spec/bson/hash_as_spec.rb +57 -0
- data/spec/bson/hash_spec.rb +209 -1
- data/spec/bson/int32_spec.rb +180 -6
- data/spec/bson/int64_spec.rb +199 -6
- data/spec/bson/integer_spec.rb +29 -3
- data/spec/bson/json_spec.rb +1 -1
- data/spec/bson/max_key_spec.rb +1 -1
- data/spec/bson/min_key_spec.rb +1 -1
- data/spec/bson/nil_class_spec.rb +1 -1
- data/spec/bson/object_id_spec.rb +1 -1
- data/spec/bson/object_spec.rb +1 -1
- data/spec/bson/open_struct_spec.rb +1 -1
- data/spec/bson/raw_spec.rb +34 -2
- data/spec/bson/regexp_spec.rb +1 -1
- data/spec/bson/registry_spec.rb +1 -1
- data/spec/bson/string_spec.rb +19 -1
- data/spec/bson/symbol_raw_spec.rb +45 -0
- data/spec/bson/symbol_spec.rb +63 -3
- data/spec/bson/time_spec.rb +205 -2
- data/spec/bson/time_with_zone_spec.rb +68 -0
- data/spec/bson/timestamp_spec.rb +56 -1
- data/spec/bson/true_class_spec.rb +1 -1
- data/spec/bson/undefined_spec.rb +1 -1
- data/spec/bson_spec.rb +1 -1
- data/spec/{support → runners}/common_driver.rb +1 -1
- data/spec/runners/corpus.rb +185 -0
- data/spec/{support/corpus.rb → runners/corpus_legacy.rb} +41 -59
- data/spec/spec_helper.rb +40 -3
- data/spec/{bson/driver_bson_spec.rb → spec_tests/common_driver_spec.rb} +1 -0
- data/spec/{bson/corpus_spec.rb → spec_tests/corpus_legacy_spec.rb} +10 -7
- data/spec/spec_tests/corpus_spec.rb +124 -0
- data/spec/spec_tests/data/corpus/README.md +15 -0
- data/spec/spec_tests/data/corpus/array.json +49 -0
- data/spec/spec_tests/data/corpus/binary.json +113 -0
- data/spec/spec_tests/data/corpus/boolean.json +27 -0
- data/spec/spec_tests/data/corpus/code.json +67 -0
- data/spec/spec_tests/data/corpus/code_w_scope.json +78 -0
- data/spec/spec_tests/data/corpus/datetime.json +42 -0
- data/spec/spec_tests/data/corpus/dbpointer.json +56 -0
- data/spec/spec_tests/data/corpus/dbref.json +31 -0
- data/spec/spec_tests/data/corpus/decimal128-1.json +317 -0
- data/spec/spec_tests/data/corpus/decimal128-2.json +793 -0
- data/spec/spec_tests/data/corpus/decimal128-3.json +1771 -0
- data/spec/spec_tests/data/corpus/decimal128-4.json +117 -0
- data/spec/spec_tests/data/corpus/decimal128-5.json +402 -0
- data/spec/spec_tests/data/corpus/decimal128-6.json +119 -0
- data/spec/spec_tests/data/corpus/decimal128-7.json +323 -0
- data/spec/spec_tests/data/corpus/document.json +36 -0
- data/spec/spec_tests/data/corpus/double.json +87 -0
- data/spec/spec_tests/data/corpus/int32.json +43 -0
- data/spec/spec_tests/data/corpus/int64.json +43 -0
- data/spec/spec_tests/data/corpus/maxkey.json +12 -0
- data/spec/spec_tests/data/corpus/minkey.json +12 -0
- data/spec/spec_tests/data/corpus/multi-type-deprecated.json +15 -0
- data/spec/spec_tests/data/corpus/multi-type.json +11 -0
- data/spec/spec_tests/data/corpus/null.json +12 -0
- data/spec/spec_tests/data/corpus/oid.json +28 -0
- data/spec/spec_tests/data/corpus/regex.json +65 -0
- data/spec/spec_tests/data/corpus/string.json +72 -0
- data/spec/spec_tests/data/corpus/symbol.json +80 -0
- data/spec/spec_tests/data/corpus/timestamp.json +34 -0
- data/spec/spec_tests/data/corpus/top.json +236 -0
- data/spec/spec_tests/data/corpus/undefined.json +15 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/array.json +8 -2
- data/spec/{support/corpus-tests/failures → spec_tests/data/corpus_legacy}/binary.json +0 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/boolean.json +0 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/code.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/code_w_scope.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/document.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/double.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/failures/datetime.json +0 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/failures/dbpointer.json +0 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/failures/int64.json +0 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/failures/symbol.json +0 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/int32.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/maxkey.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/minkey.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/null.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/oid.json +0 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/regex.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/string.json +0 -0
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/timestamp.json +1 -1
- data/spec/{support/corpus-tests → spec_tests/data/corpus_legacy}/top.json +0 -0
- data/spec/{support/corpus-tests/failures → spec_tests/data/corpus_legacy}/undefined.json +0 -0
- data/spec/{support/driver-spec-tests → spec_tests/data}/decimal128/decimal128-1.json +0 -0
- data/spec/{support/driver-spec-tests → spec_tests/data}/decimal128/decimal128-2.json +0 -0
- data/spec/{support/driver-spec-tests → spec_tests/data}/decimal128/decimal128-3.json +0 -0
- data/spec/{support/driver-spec-tests → spec_tests/data}/decimal128/decimal128-4.json +0 -0
- data/spec/{support/driver-spec-tests → spec_tests/data}/decimal128/decimal128-5.json +0 -0
- data/spec/{support/driver-spec-tests → spec_tests/data}/decimal128/decimal128-6.json +0 -0
- data/spec/{support/driver-spec-tests → spec_tests/data}/decimal128/decimal128-7.json +0 -0
- data/spec/support/shared_examples.rb +3 -5
- data/spec/support/spec_config.rb +16 -0
- data/spec/support/utils.rb +10 -0
- metadata +227 -124
- metadata.gz.sig +0 -0
- data/ext/bson/bson_native.c +0 -762
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"description": "Timestamp type",
|
3
|
+
"bson_type": "0x11",
|
4
|
+
"test_key": "a",
|
5
|
+
"valid": [
|
6
|
+
{
|
7
|
+
"description": "Timestamp: (123456789, 42)",
|
8
|
+
"canonical_bson": "100000001161002A00000015CD5B0700",
|
9
|
+
"canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : 42} } }"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"description": "Timestamp: (123456789, 42) (keys reversed)",
|
13
|
+
"canonical_bson": "100000001161002A00000015CD5B0700",
|
14
|
+
"canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : 42} } }",
|
15
|
+
"degenerate_extjson": "{\"a\" : {\"$timestamp\" : {\"i\" : 42, \"t\" : 123456789} } }"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"description": "Timestamp with high-order bit set on both seconds and increment",
|
19
|
+
"canonical_bson": "10000000116100FFFFFFFFFFFFFFFF00",
|
20
|
+
"canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 4294967295, \"i\" : 4294967295} } }"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"description": "Timestamp with high-order bit set on both seconds and increment (not UINT32_MAX)",
|
24
|
+
"canonical_bson": "1000000011610000286BEE00286BEE00",
|
25
|
+
"canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 4000000000, \"i\" : 4000000000} } }"
|
26
|
+
}
|
27
|
+
],
|
28
|
+
"decodeErrors": [
|
29
|
+
{
|
30
|
+
"description": "Truncated timestamp field",
|
31
|
+
"bson": "0f0000001161002A00000015CD5B00"
|
32
|
+
}
|
33
|
+
]
|
34
|
+
}
|
@@ -0,0 +1,236 @@
|
|
1
|
+
{
|
2
|
+
"description": "Top-level document validity",
|
3
|
+
"bson_type": "0x00",
|
4
|
+
"valid": [
|
5
|
+
{
|
6
|
+
"description": "Document with keys that start with $",
|
7
|
+
"canonical_bson": "0F00000010246B6579002A00000000",
|
8
|
+
"canonical_extjson": "{\"$key\": {\"$numberInt\": \"42\"}}"
|
9
|
+
}
|
10
|
+
],
|
11
|
+
"decodeErrors": [
|
12
|
+
{
|
13
|
+
"description": "An object size that's too small to even include the object size, but is a well-formed, empty object",
|
14
|
+
"bson": "0100000000"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"description": "An object size that's only enough for the object size, but is a well-formed, empty object",
|
18
|
+
"bson": "0400000000"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"description": "One object, with length shorter than size (missing EOO)",
|
22
|
+
"bson": "05000000"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x01",
|
26
|
+
"bson": "0500000001"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0xff",
|
30
|
+
"bson": "05000000FF"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x70",
|
34
|
+
"bson": "0500000070"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"description": "Byte count is zero (with non-zero input length)",
|
38
|
+
"bson": "00000000000000000000"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"description": "Stated length exceeds byte count, with truncated document",
|
42
|
+
"bson": "1200000002666F6F0004000000626172"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"description": "Stated length exceeds byte count, with valid envelope",
|
46
|
+
"bson": "1300000002666F6F00040000006261720000"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"description": "Stated length less than byte count, with valid envelope",
|
50
|
+
"bson": "1100000002666F6F00040000006261720000"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"description": "Invalid BSON type low range",
|
54
|
+
"bson": "07000000000000"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"description": "Invalid BSON type high range",
|
58
|
+
"bson": "07000000800000"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"description": "Document truncated mid-key",
|
62
|
+
"bson": "1200000002666F"
|
63
|
+
}
|
64
|
+
],
|
65
|
+
"parseErrors": [
|
66
|
+
{
|
67
|
+
"description" : "Bad $regularExpression (extra field)",
|
68
|
+
"string" : "{\"a\" : {\"$regularExpression\": {\"pattern\": \"abc\", \"options\": \"\", \"unrelated\": true}}}"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"description" : "Bad $regularExpression (missing options field)",
|
72
|
+
"string" : "{\"a\" : {\"$regularExpression\": {\"pattern\": \"abc\"}}}"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"description": "Bad $regularExpression (pattern is number, not string)",
|
76
|
+
"string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": 42, \"$options\" : \"\"}}}"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"description": "Bad $regularExpression (options are number, not string)",
|
80
|
+
"string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": \"a\", \"$options\" : 0}}}"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"description" : "Bad $regularExpression (missing pattern field)",
|
84
|
+
"string" : "{\"a\" : {\"$regularExpression\": {\"options\":\"ix\"}}}"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"description": "Bad $oid (number, not string)",
|
88
|
+
"string": "{\"a\" : {\"$oid\" : 42}}"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"description": "Bad $oid (extra field)",
|
92
|
+
"string": "{\"a\" : {\"$oid\" : \"56e1fc72e0c917e9c4714161\", \"unrelated\": true}}"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"description": "Bad $numberInt (number, not string)",
|
96
|
+
"string": "{\"a\" : {\"$numberInt\" : 42}}"
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"description": "Bad $numberInt (extra field)",
|
100
|
+
"string": "{\"a\" : {\"$numberInt\" : \"42\", \"unrelated\": true}}"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"description": "Bad $numberLong (number, not string)",
|
104
|
+
"string": "{\"a\" : {\"$numberLong\" : 42}}"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"description": "Bad $numberLong (extra field)",
|
108
|
+
"string": "{\"a\" : {\"$numberLong\" : \"42\", \"unrelated\": true}}"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"description": "Bad $numberDouble (number, not string)",
|
112
|
+
"string": "{\"a\" : {\"$numberDouble\" : 42}}"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"description": "Bad $numberDouble (extra field)",
|
116
|
+
"string": "{\"a\" : {\"$numberDouble\" : \".1\", \"unrelated\": true}}"
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"description": "Bad $numberDecimal (number, not string)",
|
120
|
+
"string": "{\"a\" : {\"$numberDecimal\" : 42}}"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"description": "Bad $numberDecimal (extra field)",
|
124
|
+
"string": "{\"a\" : {\"$numberDecimal\" : \".1\", \"unrelated\": true}}"
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"description": "Bad $binary (binary is number, not string)",
|
128
|
+
"string": "{\"x\" : {\"$binary\" : {\"base64\" : 0, \"subType\" : \"00\"}}}"
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"description": "Bad $binary (type is number, not string)",
|
132
|
+
"string": "{\"x\" : {\"$binary\" : {\"base64\" : \"\", \"subType\" : 0}}}"
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"description": "Bad $binary (missing $type)",
|
136
|
+
"string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\"}}}"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"description": "Bad $binary (missing $binary)",
|
140
|
+
"string": "{\"x\" : {\"$binary\" : {\"subType\" : \"00\"}}}"
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"description": "Bad $binary (extra field)",
|
144
|
+
"string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\", \"subType\" : 0, \"unrelated\": true}}}"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"description": "Bad $code (type is number, not string)",
|
148
|
+
"string": "{\"a\" : {\"$code\" : 42}}"
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"description": "Bad $code (type is number, not string) when $scope is also present",
|
152
|
+
"string": "{\"a\" : {\"$code\" : 42, \"$scope\" : {}}}"
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"description": "Bad $code (extra field)",
|
156
|
+
"string": "{\"a\" : {\"$code\" : \"\", \"unrelated\": true}}"
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"description": "Bad $code with $scope (scope is number, not doc)",
|
160
|
+
"string": "{\"x\" : {\"$code\" : \"\", \"$scope\" : 42}}"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"description": "Bad $timestamp (type is number, not doc)",
|
164
|
+
"string": "{\"a\" : {\"$timestamp\" : 42} }"
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"description": "Bad $timestamp ('t' type is string, not number)",
|
168
|
+
"string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : 42} } }"
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"description": "Bad $timestamp ('i' type is string, not number)",
|
172
|
+
"string": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : \"42\"} } }"
|
173
|
+
},
|
174
|
+
{
|
175
|
+
"description": "Bad $timestamp (extra field at same level as $timestamp)",
|
176
|
+
"string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : \"42\"}, \"unrelated\": true } }"
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"description": "Bad $timestamp (extra field at same level as t and i)",
|
180
|
+
"string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : \"42\", \"unrelated\": true} } }"
|
181
|
+
},
|
182
|
+
{
|
183
|
+
"description": "Bad $timestamp (missing t)",
|
184
|
+
"string": "{\"a\" : {\"$timestamp\" : {\"i\" : \"42\"} } }"
|
185
|
+
},
|
186
|
+
{
|
187
|
+
"description": "Bad $timestamp (missing i)",
|
188
|
+
"string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\"} } }"
|
189
|
+
},
|
190
|
+
{
|
191
|
+
"description": "Bad $date (number, not string or hash)",
|
192
|
+
"string": "{\"a\" : {\"$date\" : 42}}"
|
193
|
+
},
|
194
|
+
{
|
195
|
+
"description": "Bad $date (extra field)",
|
196
|
+
"string": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"1356351330501\"}, \"unrelated\": true}}"
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"description": "Bad DBRef (ref is number, not string)",
|
200
|
+
"string": "{\"x\" : {\"$ref\" : 42, \"$id\" : \"abc\"}}"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
"description": "Bad DBRef (db is number, not string)",
|
204
|
+
"string": "{\"x\" : {\"$ref\" : \"a\", \"$id\" : \"abc\", \"$db\" : 42}}"
|
205
|
+
},
|
206
|
+
{
|
207
|
+
"description": "Bad $minKey (boolean, not integer)",
|
208
|
+
"string": "{\"a\" : {\"$minKey\" : true}}"
|
209
|
+
},
|
210
|
+
{
|
211
|
+
"description": "Bad $minKey (wrong integer)",
|
212
|
+
"string": "{\"a\" : {\"$minKey\" : 0}}"
|
213
|
+
},
|
214
|
+
{
|
215
|
+
"description": "Bad $minKey (extra field)",
|
216
|
+
"string": "{\"a\" : {\"$minKey\" : 1, \"unrelated\": true}}"
|
217
|
+
},
|
218
|
+
{
|
219
|
+
"description": "Bad $maxKey (boolean, not integer)",
|
220
|
+
"string": "{\"a\" : {\"$maxKey\" : true}}"
|
221
|
+
},
|
222
|
+
{
|
223
|
+
"description": "Bad $maxKey (wrong integer)",
|
224
|
+
"string": "{\"a\" : {\"$maxKey\" : 0}}"
|
225
|
+
},
|
226
|
+
{
|
227
|
+
"description": "Bad $maxKey (extra field)",
|
228
|
+
"string": "{\"a\" : {\"$maxKey\" : 1, \"unrelated\": true}}"
|
229
|
+
},
|
230
|
+
{
|
231
|
+
"description": "Bad DBpointer (extra field)",
|
232
|
+
"string": "{\"a\": {\"$dbPointer\": {\"a\": {\"$numberInt\": \"1\"}, \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}, \"c\": {\"$numberInt\": \"2\"}, \"$ref\": \"b\"}}}"
|
233
|
+
}
|
234
|
+
|
235
|
+
]
|
236
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"description": "Undefined type (deprecated)",
|
3
|
+
"bson_type": "0x06",
|
4
|
+
"deprecated": true,
|
5
|
+
"test_key": "a",
|
6
|
+
"valid": [
|
7
|
+
{
|
8
|
+
"description": "Undefined",
|
9
|
+
"canonical_bson": "0800000006610000",
|
10
|
+
"canonical_extjson": "{\"a\" : {\"$undefined\" : true}}",
|
11
|
+
"converted_bson": "080000000A610000",
|
12
|
+
"converted_extjson": "{\"a\" : null}"
|
13
|
+
}
|
14
|
+
]
|
15
|
+
}
|
@@ -14,16 +14,22 @@
|
|
14
14
|
"extjson": "{\"a\" : [10]}"
|
15
15
|
},
|
16
16
|
{
|
17
|
-
"description": "Single Element Array with index set incorrectly",
|
17
|
+
"description": "Single Element Array with index set incorrectly to empty string",
|
18
18
|
"bson": "130000000461000B00000010000A0000000000",
|
19
19
|
"canonical_bson": "140000000461000C0000001030000A0000000000",
|
20
20
|
"extjson": "{\"a\" : [10]}"
|
21
21
|
},
|
22
22
|
{
|
23
|
-
"description": "Single Element Array with index set incorrectly",
|
23
|
+
"description": "Single Element Array with index set incorrectly to ab",
|
24
24
|
"bson": "150000000461000D000000106162000A0000000000",
|
25
25
|
"canonical_bson": "140000000461000C0000001030000A0000000000",
|
26
26
|
"extjson": "{\"a\" : [10]}"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"description": "Multi Element Array with duplicate indexes",
|
30
|
+
"bson": "1b000000046100130000001030000a000000103000140000000000",
|
31
|
+
"canonical_bson": "1b000000046100130000001030000a000000103100140000000000",
|
32
|
+
"extjson": "{\"a\" : [10, 20]}"
|
27
33
|
}
|
28
34
|
],
|
29
35
|
"decodeErrors": [
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2009-
|
1
|
+
# Copyright (C) 2009-2020 MongoDB Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -18,10 +18,8 @@ shared_examples_for "a binary encoded string" do
|
|
18
18
|
Encoding.find(BSON::BINARY)
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
expect(encoded.encoding).to eq(binary_encoding)
|
24
|
-
end
|
21
|
+
it "returns the string with binary encoding" do
|
22
|
+
expect(encoded.encoding).to eq(binary_encoding)
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|