bson 4.1.1 → 5.2.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.
- checksums.yaml +5 -5
- data/README.md +106 -7
- data/Rakefile +86 -43
- data/ext/bson/{native-endian.h → bson-endian.h} +14 -107
- data/ext/bson/bson-native.h +135 -0
- data/ext/bson/bytebuf.c +133 -0
- data/ext/bson/endian.c +117 -0
- data/ext/bson/extconf.rb +8 -3
- data/ext/bson/init.c +364 -0
- data/ext/bson/libbson-utf8.c +230 -0
- data/ext/bson/read.c +470 -0
- data/ext/bson/util.c +250 -0
- data/ext/bson/write.c +675 -0
- data/lib/bson/active_support.rb +19 -0
- data/lib/bson/array.rb +97 -30
- data/lib/bson/big_decimal.rb +77 -0
- data/lib/bson/binary.rb +510 -70
- data/lib/bson/boolean.rb +15 -4
- data/lib/bson/code.rb +25 -12
- data/lib/bson/code_with_scope.rb +41 -15
- data/lib/bson/config.rb +3 -28
- data/lib/bson/date.rb +16 -4
- data/lib/bson/date_time.rb +6 -4
- data/lib/bson/db_pointer.rb +110 -0
- data/lib/bson/dbref.rb +154 -0
- data/lib/bson/decimal128/builder.rb +456 -0
- data/lib/bson/decimal128.rb +272 -0
- data/lib/bson/document.rb +177 -7
- data/lib/bson/environment.rb +17 -2
- data/lib/bson/error/bson_decode_error.rb +11 -0
- data/lib/bson/error/ext_json_parse_error.rb +11 -0
- data/lib/bson/error/illegal_key.rb +23 -0
- data/lib/bson/error/invalid_binary_type.rb +37 -0
- data/lib/bson/error/invalid_dbref_argument.rb +12 -0
- data/lib/bson/error/invalid_decimal128_argument.rb +25 -0
- data/lib/bson/error/invalid_decimal128_range.rb +27 -0
- data/lib/bson/error/invalid_decimal128_string.rb +26 -0
- data/lib/bson/error/invalid_key.rb +24 -0
- data/lib/bson/error/invalid_object_id.rb +11 -0
- data/lib/bson/error/invalid_regexp_pattern.rb +13 -0
- data/lib/bson/error/unrepresentable_precision.rb +19 -0
- data/lib/bson/error/unserializable_class.rb +13 -0
- data/lib/bson/error/unsupported_binary_subtype.rb +12 -0
- data/lib/bson/error/unsupported_type.rb +11 -0
- data/lib/bson/error.rb +22 -0
- data/lib/bson/ext_json.rb +389 -0
- data/lib/bson/false_class.rb +6 -4
- data/lib/bson/float.rb +43 -7
- data/lib/bson/hash.rb +152 -37
- data/lib/bson/int32.rb +104 -6
- data/lib/bson/int64.rb +111 -8
- data/lib/bson/integer.rb +43 -9
- data/lib/bson/json.rb +3 -1
- data/lib/bson/max_key.rb +21 -10
- data/lib/bson/min_key.rb +21 -10
- data/lib/bson/nil_class.rb +7 -3
- data/lib/bson/object.rb +25 -17
- data/lib/bson/object_id.rb +98 -113
- data/lib/bson/open_struct.rb +59 -0
- data/lib/bson/regexp.rb +129 -56
- data/lib/bson/registry.rb +7 -10
- data/lib/bson/specialized.rb +8 -4
- data/lib/bson/string.rb +12 -32
- data/lib/bson/symbol.rb +107 -11
- data/lib/bson/time.rb +68 -7
- data/lib/bson/time_with_zone.rb +67 -0
- data/lib/bson/timestamp.rb +50 -10
- data/lib/bson/true_class.rb +6 -4
- data/lib/bson/undefined.rb +28 -2
- data/lib/bson/vector.rb +44 -0
- data/lib/bson/version.rb +6 -14
- data/lib/bson.rb +22 -12
- data/spec/README.md +14 -0
- data/spec/bson/array_spec.rb +38 -62
- data/spec/bson/big_decimal_spec.rb +328 -0
- data/spec/bson/binary_spec.rb +199 -53
- data/spec/bson/binary_uuid_spec.rb +190 -0
- data/spec/bson/boolean_spec.rb +2 -1
- data/spec/bson/byte_buffer_read_spec.rb +198 -0
- data/spec/bson/byte_buffer_spec.rb +122 -381
- data/spec/bson/byte_buffer_write_spec.rb +855 -0
- data/spec/bson/code_spec.rb +6 -4
- data/spec/bson/code_with_scope_spec.rb +6 -4
- data/spec/bson/config_spec.rb +1 -35
- data/spec/bson/date_spec.rb +2 -1
- data/spec/bson/date_time_spec.rb +55 -1
- data/spec/bson/dbref_legacy_spec.rb +186 -0
- data/spec/bson/dbref_spec.rb +487 -0
- data/spec/bson/decimal128_spec.rb +1840 -0
- data/spec/bson/document_as_spec.rb +61 -0
- data/spec/bson/document_spec.rb +205 -32
- data/spec/bson/ext_json_parse_spec.rb +346 -0
- data/spec/bson/false_class_spec.rb +9 -1
- data/spec/bson/float_spec.rb +42 -1
- data/spec/bson/hash_as_spec.rb +58 -0
- data/spec/bson/hash_spec.rb +318 -66
- data/spec/bson/int32_spec.rb +248 -1
- data/spec/bson/int64_spec.rb +308 -1
- data/spec/bson/integer_spec.rb +61 -3
- data/spec/bson/json_spec.rb +2 -1
- data/spec/bson/max_key_spec.rb +6 -4
- data/spec/bson/min_key_spec.rb +6 -4
- data/spec/bson/nil_class_spec.rb +2 -1
- data/spec/bson/object_id_spec.rb +95 -5
- data/spec/bson/object_spec.rb +3 -2
- data/spec/bson/open_struct_spec.rb +87 -0
- data/spec/bson/raw_spec.rb +594 -0
- data/spec/bson/regexp_spec.rb +61 -8
- data/spec/bson/registry_spec.rb +3 -2
- data/spec/bson/string_spec.rb +26 -33
- data/spec/bson/symbol_raw_spec.rb +70 -0
- data/spec/bson/symbol_spec.rb +77 -20
- data/spec/bson/time_spec.rb +206 -2
- data/spec/bson/time_with_zone_spec.rb +69 -0
- data/spec/bson/timestamp_spec.rb +58 -2
- data/spec/bson/true_class_spec.rb +9 -1
- data/spec/bson/undefined_spec.rb +28 -1
- data/spec/bson/vector_spec.rb +33 -0
- data/spec/bson_spec.rb +2 -1
- data/spec/runners/binary_vector.rb +78 -0
- data/spec/runners/common_driver.rb +348 -0
- data/spec/runners/corpus.rb +191 -0
- data/spec/runners/corpus_legacy.rb +248 -0
- data/spec/shared/LICENSE +20 -0
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/bin/s3-copy +45 -0
- data/spec/shared/bin/s3-upload +69 -0
- data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
- data/spec/shared/lib/mrss/cluster_config.rb +231 -0
- data/spec/shared/lib/mrss/constraints.rb +378 -0
- data/spec/shared/lib/mrss/docker_runner.rb +298 -0
- data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
- data/spec/shared/lib/mrss/event_subscriber.rb +210 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +238 -0
- data/spec/shared/lib/mrss/release/candidate.rb +281 -0
- data/spec/shared/lib/mrss/release/product_data.rb +144 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +113 -0
- data/spec/shared/lib/mrss/session_registry.rb +69 -0
- data/spec/shared/lib/mrss/session_registry_legacy.rb +60 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +179 -0
- data/spec/shared/lib/mrss/utils.rb +37 -0
- data/spec/shared/lib/tasks/candidate.rake +64 -0
- data/spec/shared/share/Dockerfile.erb +251 -0
- data/spec/shared/share/haproxy-1.conf +16 -0
- data/spec/shared/share/haproxy-2.conf +17 -0
- data/spec/shared/shlib/config.sh +27 -0
- data/spec/shared/shlib/distro.sh +84 -0
- data/spec/shared/shlib/server.sh +423 -0
- data/spec/shared/shlib/set_env.sh +110 -0
- data/spec/spec_helper.rb +61 -1
- data/spec/spec_tests/binary_vector_spec.rb +82 -0
- data/spec/spec_tests/common_driver_spec.rb +84 -0
- data/spec/spec_tests/corpus_legacy_spec.rb +72 -0
- data/spec/spec_tests/corpus_spec.rb +134 -0
- data/spec/spec_tests/data/binary_vector/README.md +61 -0
- data/spec/spec_tests/data/binary_vector/float32.json +65 -0
- data/spec/spec_tests/data/binary_vector/int8.json +57 -0
- data/spec/spec_tests/data/binary_vector/packed_bit.json +83 -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 +153 -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 +51 -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 +165 -0
- data/spec/spec_tests/data/corpus/decimal128-5.json +402 -0
- data/spec/spec_tests/data/corpus/decimal128-6.json +131 -0
- data/spec/spec_tests/data/corpus/decimal128-7.json +327 -0
- data/spec/spec_tests/data/corpus/document.json +60 -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 +262 -0
- data/spec/spec_tests/data/corpus/undefined.json +15 -0
- data/spec/spec_tests/data/corpus_legacy/array.json +49 -0
- data/spec/spec_tests/data/corpus_legacy/binary.json +69 -0
- data/spec/spec_tests/data/corpus_legacy/boolean.json +27 -0
- data/spec/spec_tests/data/corpus_legacy/code.json +67 -0
- data/spec/spec_tests/data/corpus_legacy/code_w_scope.json +78 -0
- data/spec/spec_tests/data/corpus_legacy/document.json +36 -0
- data/spec/spec_tests/data/corpus_legacy/double.json +69 -0
- data/spec/spec_tests/data/corpus_legacy/failures/datetime.json +31 -0
- data/spec/spec_tests/data/corpus_legacy/failures/dbpointer.json +42 -0
- data/spec/spec_tests/data/corpus_legacy/failures/int64.json +38 -0
- data/spec/spec_tests/data/corpus_legacy/failures/symbol.json +62 -0
- data/spec/spec_tests/data/corpus_legacy/int32.json +38 -0
- data/spec/spec_tests/data/corpus_legacy/maxkey.json +12 -0
- data/spec/spec_tests/data/corpus_legacy/minkey.json +12 -0
- data/spec/spec_tests/data/corpus_legacy/null.json +12 -0
- data/spec/spec_tests/data/corpus_legacy/oid.json +28 -0
- data/spec/spec_tests/data/corpus_legacy/regex.json +37 -0
- data/spec/spec_tests/data/corpus_legacy/string.json +67 -0
- data/spec/spec_tests/data/corpus_legacy/timestamp.json +18 -0
- data/spec/spec_tests/data/corpus_legacy/top.json +62 -0
- data/spec/spec_tests/data/corpus_legacy/undefined.json +13 -0
- data/spec/spec_tests/data/decimal128/decimal128-1.json +363 -0
- data/spec/spec_tests/data/decimal128/decimal128-2.json +793 -0
- data/spec/spec_tests/data/decimal128/decimal128-3.json +1771 -0
- data/spec/spec_tests/data/decimal128/decimal128-4.json +165 -0
- data/spec/spec_tests/data/decimal128/decimal128-5.json +402 -0
- data/spec/spec_tests/data/decimal128/decimal128-6.json +131 -0
- data/spec/spec_tests/data/decimal128/decimal128-7.json +327 -0
- data/spec/support/shared_examples.rb +32 -11
- data/spec/support/spec_config.rb +17 -0
- data/spec/support/utils.rb +58 -0
- metadata +284 -45
- checksums.yaml.gz.sig +0 -3
- data/ext/bson/native.c +0 -722
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Float",
|
|
3
|
+
"bson_type": "0x01",
|
|
4
|
+
"test_key": "d",
|
|
5
|
+
"valid": [
|
|
6
|
+
{
|
|
7
|
+
"description": "+1.0",
|
|
8
|
+
"bson": "10000000016400000000000000F03F00",
|
|
9
|
+
"extjson": "{\"d\" : 1.0}"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "-1.0",
|
|
13
|
+
"bson": "10000000016400000000000000F0BF00",
|
|
14
|
+
"extjson": "{\"d\" : -1.0}"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"description": "+1.0001220703125",
|
|
18
|
+
"bson": "10000000016400000000008000F03F00",
|
|
19
|
+
"extjson": "{\"d\" : 1.0001220703125}"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"description": "-1.0001220703125",
|
|
23
|
+
"bson": "10000000016400000000008000F0BF00",
|
|
24
|
+
"extjson": "{\"d\" : -1.0001220703125}"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"description": "+2.0001220703125e10",
|
|
28
|
+
"bson": "1000000001640000807ca1a9a0124200",
|
|
29
|
+
"extjson": "{\"d\" : 2.0001220703125e10}"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"description": "-2.0001220703125e10",
|
|
33
|
+
"bson": "1000000001640000807ca1a9a012c200",
|
|
34
|
+
"extjson": "{\"d\" : -2.0001220703125e10}"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"description": "0.0",
|
|
38
|
+
"bson": "10000000016400000000000000000000",
|
|
39
|
+
"extjson": "{\"d\" : 0.0}"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"description": "-0.0",
|
|
43
|
+
"bson": "10000000016400000000000000008000",
|
|
44
|
+
"extjson": "{\"d\" : -0.0}"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"description": "NaN",
|
|
48
|
+
"bson": "10000000016400000000000000F87F00"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"description": "NaN with payload",
|
|
52
|
+
"bson": "10000000016400120000000000F87F00"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"description": "Inf",
|
|
56
|
+
"bson": "10000000016400000000000000F07F00"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"description": "-Inf",
|
|
60
|
+
"bson": "10000000016400000000000000F0FF00"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"decodeErrors": [
|
|
64
|
+
{
|
|
65
|
+
"description": "double truncated",
|
|
66
|
+
"bson": "0B0000000164000000F03F00"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "DateTime",
|
|
3
|
+
"bson_type": "0x09",
|
|
4
|
+
"test_key": "a",
|
|
5
|
+
"valid": [
|
|
6
|
+
{
|
|
7
|
+
"description": "epoch",
|
|
8
|
+
"bson": "10000000096100000000000000000000",
|
|
9
|
+
"extjson": "{\"a\" : {\"$date\" : \"1970-01-01T00:00:00.000Z\"}}",
|
|
10
|
+
"canonical_extjson": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"0\"}}}"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"description": "positive ms",
|
|
14
|
+
"bson": "10000000096100C4D8D6CC3B01000000",
|
|
15
|
+
"extjson": "{\"a\" : {\"$date\" : \"2012-12-24T12:15:30.500Z\"}}",
|
|
16
|
+
"canonical_extjson": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"1356351330500\"}}}"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"description": "negative",
|
|
20
|
+
"bson": "10000000096100C43CE7B9BDFFFFFF00",
|
|
21
|
+
"extjson": "{\"a\" : {\"$date\" : \"1960-12-24T12:15:30.500Z\"}}",
|
|
22
|
+
"canonical_extjson": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"-284643869500\"}}}"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"decodeErrors": [
|
|
26
|
+
{
|
|
27
|
+
"description": "datetime field truncated",
|
|
28
|
+
"bson": "0C0000000961001234567800"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "DBPointer type (deprecated)",
|
|
3
|
+
"bson_type": "0x0C",
|
|
4
|
+
"deprecated": true,
|
|
5
|
+
"test_key": "a",
|
|
6
|
+
"valid": [
|
|
7
|
+
{
|
|
8
|
+
"description": "DBpointer",
|
|
9
|
+
"bson": "1A0000000C610002000000620056E1FC72E0C917E9C471416100"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "With two-byte UTF-8",
|
|
13
|
+
"bson": "1B0000000C610003000000C3A90056E1FC72E0C917E9C471416100"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"decodeErrors": [
|
|
17
|
+
{
|
|
18
|
+
"description": "String with negative length",
|
|
19
|
+
"bson": "1A0000000C6100FFFFFFFF620056E1FC72E0C917E9C471416100"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"description": "String with zero length",
|
|
23
|
+
"bson": "1A0000000C610000000000620056E1FC72E0C917E9C471416100"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"description": "String not null terminated",
|
|
27
|
+
"bson": "1A0000000C610002000000626256E1FC72E0C917E9C471416100"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"description": "short OID (less than minimum length for field)",
|
|
31
|
+
"bson": "160000000C61000300000061620056E1FC72E0C91700"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"description": "short OID (greater than minimum, but truncated)",
|
|
35
|
+
"bson": "1A0000000C61000300000061620056E1FC72E0C917E9C4716100"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"description": "String with bad UTF-8",
|
|
39
|
+
"bson": "1A0000000C610002000000E90056E1FC72E0C917E9C471416100"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Int64 type",
|
|
3
|
+
"bson_type": "0x12",
|
|
4
|
+
"test_key": "a",
|
|
5
|
+
"valid": [
|
|
6
|
+
{
|
|
7
|
+
"description": "MinValue",
|
|
8
|
+
"bson": "10000000126100000000000000008000",
|
|
9
|
+
"extjson": "{\"a\" : {\"$numberLong\" : \"-9223372036854775808\"}}"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "MaxValue",
|
|
13
|
+
"bson": "10000000126100FFFFFFFFFFFFFF7F00",
|
|
14
|
+
"extjson": "{\"a\" : {\"$numberLong\" : \"9223372036854775807\"}}"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"description": "-1",
|
|
18
|
+
"bson": "10000000126100FFFFFFFFFFFFFFFF00",
|
|
19
|
+
"extjson": "{\"a\" : {\"$numberLong\" : \"-1\"}}"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"description": "0",
|
|
23
|
+
"bson": "10000000126100000000000000000000",
|
|
24
|
+
"extjson": "{\"a\" : {\"$numberLong\" : \"0\"}}"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"description": "1",
|
|
28
|
+
"bson": "10000000126100010000000000000000",
|
|
29
|
+
"extjson": "{\"a\" : {\"$numberLong\" : \"1\"}}"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"decodeErrors": [
|
|
33
|
+
{
|
|
34
|
+
"description": "int64 field truncated",
|
|
35
|
+
"bson": "0C0000001261001234567800"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Symbol",
|
|
3
|
+
"bson_type": "0x0E",
|
|
4
|
+
"deprecated": true,
|
|
5
|
+
"test_key": "a",
|
|
6
|
+
"valid": [
|
|
7
|
+
{
|
|
8
|
+
"description": "Empty string",
|
|
9
|
+
"bson": "0D0000000E6100010000000000"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "Single character",
|
|
13
|
+
"bson": "0E0000000E610002000000620000"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"description": "Multi-character",
|
|
17
|
+
"bson": "190000000E61000D0000006162616261626162616261620000"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"description": "two-byte UTF-8 (\u00e9)",
|
|
21
|
+
"bson": "190000000E61000D000000C3A9C3A9C3A9C3A9C3A9C3A90000"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"description": "three-byte UTF-8 (\u2606)",
|
|
25
|
+
"bson": "190000000E61000D000000E29886E29886E29886E298860000"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"description": "Embedded nulls",
|
|
29
|
+
"bson": "190000000E61000D0000006162006261620062616261620000"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"decodeErrors": [
|
|
33
|
+
{
|
|
34
|
+
"description": "bad symbol length: 0 (but no 0x00 either)",
|
|
35
|
+
"bson": "0C0000000261000000000000"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"description": "bad symbol length: -1",
|
|
39
|
+
"bson": "0C000000026100FFFFFFFF00"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"description": "bad symbol length: eats terminator",
|
|
43
|
+
"bson": "10000000026100050000006200620000"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"description": "bad symbol length: longer than rest of document",
|
|
47
|
+
"bson": "120000000200FFFFFF00666F6F6261720000"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"description": "symbol is not null-terminated",
|
|
51
|
+
"bson": "1000000002610004000000616263FF00"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"description": "empty symbol, but extra null",
|
|
55
|
+
"bson": "0E00000002610001000000000000"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"description": "invalid UTF-8",
|
|
59
|
+
"bson": "0E00000002610002000000E90000"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Integer",
|
|
3
|
+
"bson_type": "0x10",
|
|
4
|
+
"test_key": "i",
|
|
5
|
+
"valid": [
|
|
6
|
+
{
|
|
7
|
+
"description": "MinValue",
|
|
8
|
+
"bson": "0C0000001069000000008000",
|
|
9
|
+
"extjson": "{\"i\" : -2147483648}"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "MaxValue",
|
|
13
|
+
"bson": "0C000000106900FFFFFF7F00",
|
|
14
|
+
"extjson": "{\"i\" : 2147483647}"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"description": "-1",
|
|
18
|
+
"bson": "0C000000106900FFFFFFFF00",
|
|
19
|
+
"extjson": "{\"i\" : -1}"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"description": "0",
|
|
23
|
+
"bson": "0C0000001069000000000000",
|
|
24
|
+
"extjson": "{\"i\" : 0}"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"description": "1",
|
|
28
|
+
"bson": "0C0000001069000100000000",
|
|
29
|
+
"extjson": "{\"i\" : 1}"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"decodeErrors": [
|
|
33
|
+
{
|
|
34
|
+
"description": "Bad int32 field length",
|
|
35
|
+
"bson": "090000001061000500"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "ObjectId",
|
|
3
|
+
"bson_type": "0x07",
|
|
4
|
+
"test_key": "a",
|
|
5
|
+
"valid": [
|
|
6
|
+
{
|
|
7
|
+
"description": "All zeroes",
|
|
8
|
+
"bson": "1400000007610000000000000000000000000000",
|
|
9
|
+
"extjson": "{\"a\" : {\"$oid\" : \"000000000000000000000000\"}}"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "All ones",
|
|
13
|
+
"bson": "14000000076100FFFFFFFFFFFFFFFFFFFFFFFF00",
|
|
14
|
+
"extjson": "{\"a\" : {\"$oid\" : \"ffffffffffffffffffffffff\"}}"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"description": "Random",
|
|
18
|
+
"bson": "1400000007610056E1FC72E0C917E9C471416100",
|
|
19
|
+
"extjson": "{\"a\" : {\"$oid\" : \"56e1fc72e0c917e9c4714161\"}}"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"decodeErrors": [
|
|
23
|
+
{
|
|
24
|
+
"description": "OID truncated",
|
|
25
|
+
"bson": "1200000007610056E1FC72E0C917E9C471"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Regexp",
|
|
3
|
+
"bson_type": "0x0B",
|
|
4
|
+
"test_key": "a",
|
|
5
|
+
"valid": [
|
|
6
|
+
{
|
|
7
|
+
"description": "empty regex with no options",
|
|
8
|
+
"bson": "0A0000000B6100000000",
|
|
9
|
+
"extjson": "{\"a\" : {\"$regex\" : \"\", \"$options\" : \"\"}}"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "regex without options",
|
|
13
|
+
"bson": "0D0000000B6100616263000000",
|
|
14
|
+
"extjson": "{\"a\" : {\"$regex\" : \"abc\", \"$options\" : \"\"}}"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"description": "regex with options",
|
|
18
|
+
"bson": "0F0000000B610061626300696D0000",
|
|
19
|
+
"extjson": "{\"a\" : {\"$regex\" : \"abc\", \"$options\" : \"im\"}}"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"description": "regex with slash",
|
|
23
|
+
"bson": "110000000B610061622F636400696D0000",
|
|
24
|
+
"extjson": "{\"a\" : {\"$regex\" : \"ab/cd\", \"$options\" : \"im\"}}"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"decodeErrors": [
|
|
28
|
+
{
|
|
29
|
+
"description": "embedded null in pattern",
|
|
30
|
+
"bson": "0F0000000B610061006300696D0000"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"description": "embedded null in flags",
|
|
34
|
+
"bson": "100000000B61006162630069006D0000"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "String",
|
|
3
|
+
"bson_type": "0x02",
|
|
4
|
+
"test_key": "a",
|
|
5
|
+
"valid": [
|
|
6
|
+
{
|
|
7
|
+
"description": "Empty string",
|
|
8
|
+
"bson": "0D000000026100010000000000",
|
|
9
|
+
"extjson": "{\"a\" : \"\"}"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "Single character",
|
|
13
|
+
"bson": "0E00000002610002000000620000",
|
|
14
|
+
"extjson": "{\"a\" : \"b\"}"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"description": "Multi-character",
|
|
18
|
+
"bson": "190000000261000D0000006162616261626162616261620000",
|
|
19
|
+
"extjson": "{\"a\" : \"abababababab\"}"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"description": "two-byte UTF-8 (\u00e9)",
|
|
23
|
+
"bson": "190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000",
|
|
24
|
+
"extjson": "{\"a\" : \"\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\"}"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"description": "three-byte UTF-8 (\u2606)",
|
|
28
|
+
"bson": "190000000261000D000000E29886E29886E29886E298860000",
|
|
29
|
+
"extjson": "{\"a\" : \"\\u2606\\u2606\\u2606\\u2606\"}"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"description": "Embedded nulls",
|
|
33
|
+
"bson": "190000000261000D0000006162006261620062616261620000",
|
|
34
|
+
"extjson": "{\"a\" : \"ab\\u0000bab\\u0000babab\"}"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"decodeErrors": [
|
|
38
|
+
{
|
|
39
|
+
"description": "bad string length: 0 (but no 0x00 either)",
|
|
40
|
+
"bson": "0C0000000261000000000000"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"description": "bad string length: -1",
|
|
44
|
+
"bson": "0C000000026100FFFFFFFF00"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"description": "bad string length: eats terminator",
|
|
48
|
+
"bson": "10000000026100050000006200620000"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"description": "bad string length: longer than rest of document",
|
|
52
|
+
"bson": "120000000200FFFFFF00666F6F6261720000"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"description": "string is not null-terminated",
|
|
56
|
+
"bson": "1000000002610004000000616263FF00"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"description": "empty string, but extra null",
|
|
60
|
+
"bson": "0E00000002610001000000000000"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"description": "invalid UTF-8",
|
|
64
|
+
"bson": "0E00000002610002000000E90000"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Timestamp",
|
|
3
|
+
"bson_type": "0x11",
|
|
4
|
+
"test_key": "a",
|
|
5
|
+
"valid": [
|
|
6
|
+
{
|
|
7
|
+
"description": "Timestamp: (123456789, 42)",
|
|
8
|
+
"bson": "100000001161002A00000015CD5B0700",
|
|
9
|
+
"extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : 42}}}"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"decodeErrors": [
|
|
13
|
+
{
|
|
14
|
+
"description": "Truncated timestamp field",
|
|
15
|
+
"bson": "0f0000001161002A00000015CD5B00"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Top-level document validity",
|
|
3
|
+
"bson_type": "0x00",
|
|
4
|
+
"decodeErrors": [
|
|
5
|
+
{
|
|
6
|
+
"description": "An object size that's too small to even include the object size, but is a well-formed, empty object",
|
|
7
|
+
"bson": "0100000000"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"description": "An object size that's only enough for the object size, but is a well-formed, empty object",
|
|
11
|
+
"bson": "0400000000"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"description": "One object, with length shorter than size (missing EOO)",
|
|
15
|
+
"bson": "05000000"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x01",
|
|
19
|
+
"bson": "0500000001"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0xff",
|
|
23
|
+
"bson": "05000000FF"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x70",
|
|
27
|
+
"bson": "0500000070"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"description": "Byte count is zero (with non-zero input length)",
|
|
31
|
+
"bson": "00000000000000000000"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"description": "Stated length exceeds byte count, with truncated document",
|
|
35
|
+
"bson": "1200000002666F6F0004000000626172"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"description": "Stated length less than byte count, with garbage after envelope",
|
|
39
|
+
"bson": "1200000002666F6F00040000006261720000DEADBEEF"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"description": "Stated length exceeds byte count, with valid envelope",
|
|
43
|
+
"bson": "1300000002666F6F00040000006261720000"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"description": "Stated length less than byte count, with valid envelope",
|
|
47
|
+
"bson": "1100000002666F6F00040000006261720000"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"description": "Invalid BSON type low range",
|
|
51
|
+
"bson": "07000000000000"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"description": "Invalid BSON type high range",
|
|
55
|
+
"bson": "07000000800000"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"description": "Document truncated mid-key",
|
|
59
|
+
"bson": "1200000002666F"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Undefined type (deprecated)",
|
|
3
|
+
"bson_type": "0x06",
|
|
4
|
+
"deprecated": true,
|
|
5
|
+
"test_key": "a",
|
|
6
|
+
"valid": [
|
|
7
|
+
{
|
|
8
|
+
"description": "Undefined",
|
|
9
|
+
"bson": "0800000006610000",
|
|
10
|
+
"extjson": "{\"a\" : {\"$undefined\" : true}}"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|