bson 4.7.0-java → 4.9.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/bson-ruby.jar +0 -0
- data/lib/bson.rb +4 -1
- data/lib/bson/active_support.rb +1 -1
- data/lib/bson/array.rb +34 -5
- data/lib/bson/binary.rb +42 -4
- 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 +1 -1
- data/lib/bson/date_time.rb +1 -1
- data/lib/bson/db_pointer.rb +110 -0
- data/lib/bson/decimal128.rb +16 -2
- data/lib/bson/decimal128/builder.rb +1 -1
- data/lib/bson/document.rb +1 -1
- data/lib/bson/environment.rb +2 -1
- data/lib/bson/error.rb +21 -0
- data/lib/bson/ext_json.rb +375 -0
- data/lib/bson/false_class.rb +1 -1
- data/lib/bson/float.rb +48 -2
- data/lib/bson/hash.rb +36 -5
- data/lib/bson/int32.rb +22 -2
- data/lib/bson/int64.rb +29 -4
- data/lib/bson/integer.rb +35 -1
- 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 +20 -3
- data/lib/bson/registry.rb +1 -1
- data/lib/bson/specialized.rb +4 -2
- data/lib/bson/string.rb +4 -2
- data/lib/bson/symbol.rb +93 -4
- data/lib/bson/time.rb +63 -4
- data/lib/bson/time_with_zone.rb +1 -1
- data/lib/bson/timestamp.rb +16 -2
- 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 +1 -1
- data/spec/bson/binary_spec.rb +34 -4
- data/spec/bson/binary_uuid_spec.rb +1 -1
- data/spec/bson/boolean_spec.rb +1 -1
- 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 +1 -1
- data/spec/bson/decimal128_spec.rb +1 -1
- data/spec/bson/document_spec.rb +1 -1
- 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_spec.rb +71 -1
- data/spec/bson/int32_spec.rb +21 -1
- data/spec/bson/int64_spec.rb +39 -1
- data/spec/bson/integer_spec.rb +27 -1
- 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 +22 -1
- data/spec/bson/regexp_spec.rb +1 -1
- data/spec/bson/registry_spec.rb +1 -1
- data/spec/bson/string_spec.rb +1 -1
- data/spec/bson/symbol_raw_spec.rb +45 -0
- data/spec/bson/symbol_spec.rb +61 -1
- data/spec/bson/time_spec.rb +205 -2
- data/spec/bson/time_with_zone_spec.rb +1 -1
- data/spec/bson/timestamp_spec.rb +1 -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 +10 -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} +4 -4
- 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 +85 -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 +24 -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 +0 -0
- 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 +1 -1
- metadata +171 -120
- checksums.yaml.gz.sig +0 -2
- data.tar.gz.sig +0 -1
- metadata.gz.sig +0 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
{
|
2
|
+
"description": "Double type",
|
3
|
+
"bson_type": "0x01",
|
4
|
+
"test_key": "d",
|
5
|
+
"valid": [
|
6
|
+
{
|
7
|
+
"description": "+1.0",
|
8
|
+
"canonical_bson": "10000000016400000000000000F03F00",
|
9
|
+
"canonical_extjson": "{\"d\" : {\"$numberDouble\": \"1.0\"}}",
|
10
|
+
"relaxed_extjson": "{\"d\" : 1.0}"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"description": "-1.0",
|
14
|
+
"canonical_bson": "10000000016400000000000000F0BF00",
|
15
|
+
"canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-1.0\"}}",
|
16
|
+
"relaxed_extjson": "{\"d\" : -1.0}"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"description": "+1.0001220703125",
|
20
|
+
"canonical_bson": "10000000016400000000008000F03F00",
|
21
|
+
"canonical_extjson": "{\"d\" : {\"$numberDouble\": \"1.0001220703125\"}}",
|
22
|
+
"relaxed_extjson": "{\"d\" : 1.0001220703125}"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"description": "-1.0001220703125",
|
26
|
+
"canonical_bson": "10000000016400000000008000F0BF00",
|
27
|
+
"canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-1.0001220703125\"}}",
|
28
|
+
"relaxed_extjson": "{\"d\" : -1.0001220703125}"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"description": "1.2345678921232E+18",
|
32
|
+
"canonical_bson": "100000000164002a1bf5f41022b14300",
|
33
|
+
"canonical_extjson": "{\"d\" : {\"$numberDouble\": \"1.2345678921232E+18\"}}",
|
34
|
+
"relaxed_extjson": "{\"d\" : 1.2345678921232E+18}"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"description": "-1.2345678921232E+18",
|
38
|
+
"canonical_bson": "100000000164002a1bf5f41022b1c300",
|
39
|
+
"canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-1.2345678921232E+18\"}}",
|
40
|
+
"relaxed_extjson": "{\"d\" : -1.2345678921232E+18}"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"description": "0.0",
|
44
|
+
"canonical_bson": "10000000016400000000000000000000",
|
45
|
+
"canonical_extjson": "{\"d\" : {\"$numberDouble\": \"0.0\"}}",
|
46
|
+
"relaxed_extjson": "{\"d\" : 0.0}"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"description": "-0.0",
|
50
|
+
"canonical_bson": "10000000016400000000000000008000",
|
51
|
+
"canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-0.0\"}}",
|
52
|
+
"relaxed_extjson": "{\"d\" : -0.0}"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"description": "NaN",
|
56
|
+
"canonical_bson": "10000000016400000000000000F87F00",
|
57
|
+
"canonical_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}",
|
58
|
+
"relaxed_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}",
|
59
|
+
"lossy": true
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"description": "NaN with payload",
|
63
|
+
"canonical_bson": "10000000016400120000000000F87F00",
|
64
|
+
"canonical_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}",
|
65
|
+
"relaxed_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}",
|
66
|
+
"lossy": true
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"description": "Inf",
|
70
|
+
"canonical_bson": "10000000016400000000000000F07F00",
|
71
|
+
"canonical_extjson": "{\"d\": {\"$numberDouble\": \"Infinity\"}}",
|
72
|
+
"relaxed_extjson": "{\"d\": {\"$numberDouble\": \"Infinity\"}}"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"description": "-Inf",
|
76
|
+
"canonical_bson": "10000000016400000000000000F0FF00",
|
77
|
+
"canonical_extjson": "{\"d\": {\"$numberDouble\": \"-Infinity\"}}",
|
78
|
+
"relaxed_extjson": "{\"d\": {\"$numberDouble\": \"-Infinity\"}}"
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"decodeErrors": [
|
82
|
+
{
|
83
|
+
"description": "double truncated",
|
84
|
+
"bson": "0B0000000164000000F03F00"
|
85
|
+
}
|
86
|
+
]
|
87
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"description": "Int32 type",
|
3
|
+
"bson_type": "0x10",
|
4
|
+
"test_key": "i",
|
5
|
+
"valid": [
|
6
|
+
{
|
7
|
+
"description": "MinValue",
|
8
|
+
"canonical_bson": "0C0000001069000000008000",
|
9
|
+
"canonical_extjson": "{\"i\" : {\"$numberInt\": \"-2147483648\"}}",
|
10
|
+
"relaxed_extjson": "{\"i\" : -2147483648}"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"description": "MaxValue",
|
14
|
+
"canonical_bson": "0C000000106900FFFFFF7F00",
|
15
|
+
"canonical_extjson": "{\"i\" : {\"$numberInt\": \"2147483647\"}}",
|
16
|
+
"relaxed_extjson": "{\"i\" : 2147483647}"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"description": "-1",
|
20
|
+
"canonical_bson": "0C000000106900FFFFFFFF00",
|
21
|
+
"canonical_extjson": "{\"i\" : {\"$numberInt\": \"-1\"}}",
|
22
|
+
"relaxed_extjson": "{\"i\" : -1}"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"description": "0",
|
26
|
+
"canonical_bson": "0C0000001069000000000000",
|
27
|
+
"canonical_extjson": "{\"i\" : {\"$numberInt\": \"0\"}}",
|
28
|
+
"relaxed_extjson": "{\"i\" : 0}"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"description": "1",
|
32
|
+
"canonical_bson": "0C0000001069000100000000",
|
33
|
+
"canonical_extjson": "{\"i\" : {\"$numberInt\": \"1\"}}",
|
34
|
+
"relaxed_extjson": "{\"i\" : 1}"
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"decodeErrors": [
|
38
|
+
{
|
39
|
+
"description": "Bad int32 field length",
|
40
|
+
"bson": "090000001061000500"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"description": "Int64 type",
|
3
|
+
"bson_type": "0x12",
|
4
|
+
"test_key": "a",
|
5
|
+
"valid": [
|
6
|
+
{
|
7
|
+
"description": "MinValue",
|
8
|
+
"canonical_bson": "10000000126100000000000000008000",
|
9
|
+
"canonical_extjson": "{\"a\" : {\"$numberLong\" : \"-9223372036854775808\"}}",
|
10
|
+
"relaxed_extjson": "{\"a\" : -9223372036854775808}"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"description": "MaxValue",
|
14
|
+
"canonical_bson": "10000000126100FFFFFFFFFFFFFF7F00",
|
15
|
+
"canonical_extjson": "{\"a\" : {\"$numberLong\" : \"9223372036854775807\"}}",
|
16
|
+
"relaxed_extjson": "{\"a\" : 9223372036854775807}"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"description": "-1",
|
20
|
+
"canonical_bson": "10000000126100FFFFFFFFFFFFFFFF00",
|
21
|
+
"canonical_extjson": "{\"a\" : {\"$numberLong\" : \"-1\"}}",
|
22
|
+
"relaxed_extjson": "{\"a\" : -1}"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"description": "0",
|
26
|
+
"canonical_bson": "10000000126100000000000000000000",
|
27
|
+
"canonical_extjson": "{\"a\" : {\"$numberLong\" : \"0\"}}",
|
28
|
+
"relaxed_extjson": "{\"a\" : 0}"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"description": "1",
|
32
|
+
"canonical_bson": "10000000126100010000000000000000",
|
33
|
+
"canonical_extjson": "{\"a\" : {\"$numberLong\" : \"1\"}}",
|
34
|
+
"relaxed_extjson": "{\"a\" : 1}"
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"decodeErrors": [
|
38
|
+
{
|
39
|
+
"description": "int64 field truncated",
|
40
|
+
"bson": "0C0000001261001234567800"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"description": "Multiple types within the same document",
|
3
|
+
"bson_type": "0x00",
|
4
|
+
"deprecated": true,
|
5
|
+
"valid": [
|
6
|
+
{
|
7
|
+
"description": "All BSON types",
|
8
|
+
"canonical_bson": "38020000075F69640057E193D7A9CC81B4027498B50E53796D626F6C000700000073796D626F6C0002537472696E670007000000737472696E670010496E743332002A00000012496E743634002A0000000000000001446F75626C6500000000000000F0BF0542696E617279001000000003A34C38F7C3ABEDC8A37814A992AB8DB60542696E61727955736572446566696E656400050000008001020304050D436F6465000E00000066756E6374696F6E2829207B7D000F436F64655769746853636F7065001B0000000E00000066756E6374696F6E2829207B7D00050000000003537562646F63756D656E74001200000002666F6F0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696D657374616D7000010000002A0000000B5265676578007061747465726E0000094461746574696D6545706F6368000000000000000000094461746574696D65506F73697469766500FFFFFF7F00000000094461746574696D654E656761746976650000000080FFFFFFFF085472756500010846616C736500000C4442506F696E746572000B000000636F6C6C656374696F6E0057E193D7A9CC81B4027498B1034442526566003D0000000224726566000B000000636F6C6C656374696F6E00072469640057FD71E96E32AB4225B723FB02246462000900000064617461626173650000FF4D696E6B6579007F4D61786B6579000A4E756C6C0006556E646566696E65640000",
|
9
|
+
"converted_bson": "48020000075f69640057e193d7a9cc81b4027498b50253796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c73650000034442506f696e746572002b0000000224726566000b000000636f6c6c656374696f6e00072469640057e193d7a9cc81b4027498b100034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c000a556e646566696e65640000",
|
10
|
+
"canonical_extjson": "{\"_id\": {\"$oid\": \"57e193d7a9cc81b4027498b5\"}, \"Symbol\": {\"$symbol\": \"symbol\"}, \"String\": \"string\", \"Int32\": {\"$numberInt\": \"42\"}, \"Int64\": {\"$numberLong\": \"42\"}, \"Double\": {\"$numberDouble\": \"-1.0\"}, \"Binary\": { \"$binary\" : {\"base64\": \"o0w498Or7cijeBSpkquNtg==\", \"subType\": \"03\"}}, \"BinaryUserDefined\": { \"$binary\" : {\"base64\": \"AQIDBAU=\", \"subType\": \"80\"}}, \"Code\": {\"$code\": \"function() {}\"}, \"CodeWithScope\": {\"$code\": \"function() {}\", \"$scope\": {}}, \"Subdocument\": {\"foo\": \"bar\"}, \"Array\": [{\"$numberInt\": \"1\"}, {\"$numberInt\": \"2\"}, {\"$numberInt\": \"3\"}, {\"$numberInt\": \"4\"}, {\"$numberInt\": \"5\"}], \"Timestamp\": {\"$timestamp\": {\"t\": 42, \"i\": 1}}, \"Regex\": {\"$regularExpression\": {\"pattern\": \"pattern\", \"options\": \"\"}}, \"DatetimeEpoch\": {\"$date\": {\"$numberLong\": \"0\"}}, \"DatetimePositive\": {\"$date\": {\"$numberLong\": \"2147483647\"}}, \"DatetimeNegative\": {\"$date\": {\"$numberLong\": \"-2147483648\"}}, \"True\": true, \"False\": false, \"DBPointer\": {\"$dbPointer\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"57e193d7a9cc81b4027498b1\"}}}, \"DBRef\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"57fd71e96e32ab4225b723fb\"}, \"$db\": \"database\"}, \"Minkey\": {\"$minKey\": 1}, \"Maxkey\": {\"$maxKey\": 1}, \"Null\": null, \"Undefined\": {\"$undefined\": true}}",
|
11
|
+
"converted_extjson": "{\"_id\": {\"$oid\": \"57e193d7a9cc81b4027498b5\"}, \"Symbol\": \"symbol\", \"String\": \"string\", \"Int32\": {\"$numberInt\": \"42\"}, \"Int64\": {\"$numberLong\": \"42\"}, \"Double\": {\"$numberDouble\": \"-1.0\"}, \"Binary\": { \"$binary\" : {\"base64\": \"o0w498Or7cijeBSpkquNtg==\", \"subType\": \"03\"}}, \"BinaryUserDefined\": { \"$binary\" : {\"base64\": \"AQIDBAU=\", \"subType\": \"80\"}}, \"Code\": {\"$code\": \"function() {}\"}, \"CodeWithScope\": {\"$code\": \"function() {}\", \"$scope\": {}}, \"Subdocument\": {\"foo\": \"bar\"}, \"Array\": [{\"$numberInt\": \"1\"}, {\"$numberInt\": \"2\"}, {\"$numberInt\": \"3\"}, {\"$numberInt\": \"4\"}, {\"$numberInt\": \"5\"}], \"Timestamp\": {\"$timestamp\": {\"t\": 42, \"i\": 1}}, \"Regex\": {\"$regularExpression\": {\"pattern\": \"pattern\", \"options\": \"\"}}, \"DatetimeEpoch\": {\"$date\": {\"$numberLong\": \"0\"}}, \"DatetimePositive\": {\"$date\": {\"$numberLong\": \"2147483647\"}}, \"DatetimeNegative\": {\"$date\": {\"$numberLong\": \"-2147483648\"}}, \"True\": true, \"False\": false, \"DBPointer\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"57e193d7a9cc81b4027498b1\"}}, \"DBRef\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"57fd71e96e32ab4225b723fb\"}, \"$db\": \"database\"}, \"Minkey\": {\"$minKey\": 1}, \"Maxkey\": {\"$maxKey\": 1}, \"Null\": null, \"Undefined\": null}"
|
12
|
+
}
|
13
|
+
]
|
14
|
+
}
|
15
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"description": "Multiple types within the same document",
|
3
|
+
"bson_type": "0x00",
|
4
|
+
"valid": [
|
5
|
+
{
|
6
|
+
"description": "All BSON types",
|
7
|
+
"canonical_bson": "F4010000075F69640057E193D7A9CC81B4027498B502537472696E670007000000737472696E670010496E743332002A00000012496E743634002A0000000000000001446F75626C6500000000000000F0BF0542696E617279001000000003A34C38F7C3ABEDC8A37814A992AB8DB60542696E61727955736572446566696E656400050000008001020304050D436F6465000E00000066756E6374696F6E2829207B7D000F436F64655769746853636F7065001B0000000E00000066756E6374696F6E2829207B7D00050000000003537562646F63756D656E74001200000002666F6F0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696D657374616D7000010000002A0000000B5265676578007061747465726E0000094461746574696D6545706F6368000000000000000000094461746574696D65506F73697469766500FFFFFF7F00000000094461746574696D654E656761746976650000000080FFFFFFFF085472756500010846616C73650000034442526566003D0000000224726566000B000000636F6C6C656374696F6E00072469640057FD71E96E32AB4225B723FB02246462000900000064617461626173650000FF4D696E6B6579007F4D61786B6579000A4E756C6C0000",
|
8
|
+
"canonical_extjson": "{\"_id\": {\"$oid\": \"57e193d7a9cc81b4027498b5\"}, \"String\": \"string\", \"Int32\": {\"$numberInt\": \"42\"}, \"Int64\": {\"$numberLong\": \"42\"}, \"Double\": {\"$numberDouble\": \"-1.0\"}, \"Binary\": { \"$binary\" : {\"base64\": \"o0w498Or7cijeBSpkquNtg==\", \"subType\": \"03\"}}, \"BinaryUserDefined\": { \"$binary\" : {\"base64\": \"AQIDBAU=\", \"subType\": \"80\"}}, \"Code\": {\"$code\": \"function() {}\"}, \"CodeWithScope\": {\"$code\": \"function() {}\", \"$scope\": {}}, \"Subdocument\": {\"foo\": \"bar\"}, \"Array\": [{\"$numberInt\": \"1\"}, {\"$numberInt\": \"2\"}, {\"$numberInt\": \"3\"}, {\"$numberInt\": \"4\"}, {\"$numberInt\": \"5\"}], \"Timestamp\": {\"$timestamp\": {\"t\": 42, \"i\": 1}}, \"Regex\": {\"$regularExpression\": {\"pattern\": \"pattern\", \"options\": \"\"}}, \"DatetimeEpoch\": {\"$date\": {\"$numberLong\": \"0\"}}, \"DatetimePositive\": {\"$date\": {\"$numberLong\": \"2147483647\"}}, \"DatetimeNegative\": {\"$date\": {\"$numberLong\": \"-2147483648\"}}, \"True\": true, \"False\": false, \"DBRef\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"57fd71e96e32ab4225b723fb\"}, \"$db\": \"database\"}, \"Minkey\": {\"$minKey\": 1}, \"Maxkey\": {\"$maxKey\": 1}, \"Null\": null}"
|
9
|
+
}
|
10
|
+
]
|
11
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"description": "ObjectId",
|
3
|
+
"bson_type": "0x07",
|
4
|
+
"test_key": "a",
|
5
|
+
"valid": [
|
6
|
+
{
|
7
|
+
"description": "All zeroes",
|
8
|
+
"canonical_bson": "1400000007610000000000000000000000000000",
|
9
|
+
"canonical_extjson": "{\"a\" : {\"$oid\" : \"000000000000000000000000\"}}"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"description": "All ones",
|
13
|
+
"canonical_bson": "14000000076100FFFFFFFFFFFFFFFFFFFFFFFF00",
|
14
|
+
"canonical_extjson": "{\"a\" : {\"$oid\" : \"ffffffffffffffffffffffff\"}}"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"description": "Random",
|
18
|
+
"canonical_bson": "1400000007610056E1FC72E0C917E9C471416100",
|
19
|
+
"canonical_extjson": "{\"a\" : {\"$oid\" : \"56e1fc72e0c917e9c4714161\"}}"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"decodeErrors": [
|
23
|
+
{
|
24
|
+
"description": "OID truncated",
|
25
|
+
"bson": "1200000007610056E1FC72E0C917E9C471"
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
{
|
2
|
+
"description": "Regular Expression type",
|
3
|
+
"bson_type": "0x0B",
|
4
|
+
"test_key": "a",
|
5
|
+
"valid": [
|
6
|
+
{
|
7
|
+
"description": "empty regex with no options",
|
8
|
+
"canonical_bson": "0A0000000B6100000000",
|
9
|
+
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"\", \"options\" : \"\"}}}"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"description": "regex without options",
|
13
|
+
"canonical_bson": "0D0000000B6100616263000000",
|
14
|
+
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"\"}}}"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"description": "regex with options",
|
18
|
+
"canonical_bson": "0F0000000B610061626300696D0000",
|
19
|
+
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"im\"}}}"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"description": "regex with options (keys reversed)",
|
23
|
+
"canonical_bson": "0F0000000B610061626300696D0000",
|
24
|
+
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"im\"}}}",
|
25
|
+
"degenerate_extjson": "{\"a\" : {\"$regularExpression\" : {\"options\" : \"im\", \"pattern\": \"abc\"}}}"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"description": "regex with slash",
|
29
|
+
"canonical_bson": "110000000B610061622F636400696D0000",
|
30
|
+
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"ab/cd\", \"options\" : \"im\"}}}"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"description": "flags not alphabetized",
|
34
|
+
"degenerate_bson": "100000000B6100616263006D69780000",
|
35
|
+
"canonical_bson": "100000000B610061626300696D780000",
|
36
|
+
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"imx\"}}}",
|
37
|
+
"degenerate_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"mix\"}}}"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"description" : "Required escapes",
|
41
|
+
"canonical_bson" : "100000000B610061625C226162000000",
|
42
|
+
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"ab\\\\\\\"ab\", \"options\" : \"\"}}}"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"description" : "Regular expression as value of $regex query operator",
|
46
|
+
"canonical_bson" : "180000000B247265676578007061747465726E0069780000",
|
47
|
+
"canonical_extjson": "{\"$regex\" : {\"$regularExpression\" : { \"pattern\": \"pattern\", \"options\" : \"ix\"}}}"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"description" : "Regular expression as value of $regex query operator with $options",
|
51
|
+
"canonical_bson" : "270000000B247265676578007061747465726E000002246F7074696F6E73000300000069780000",
|
52
|
+
"canonical_extjson": "{\"$regex\" : {\"$regularExpression\" : { \"pattern\": \"pattern\", \"options\" : \"\"}}, \"$options\" : \"ix\"}"
|
53
|
+
}
|
54
|
+
],
|
55
|
+
"decodeErrors": [
|
56
|
+
{
|
57
|
+
"description": "embedded null in pattern",
|
58
|
+
"bson": "0F0000000B610061006300696D0000"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"description": "embedded null in flags",
|
62
|
+
"bson": "100000000B61006162630069006D0000"
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
{
|
2
|
+
"description": "String",
|
3
|
+
"bson_type": "0x02",
|
4
|
+
"test_key": "a",
|
5
|
+
"valid": [
|
6
|
+
{
|
7
|
+
"description": "Empty string",
|
8
|
+
"canonical_bson": "0D000000026100010000000000",
|
9
|
+
"canonical_extjson": "{\"a\" : \"\"}"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"description": "Single character",
|
13
|
+
"canonical_bson": "0E00000002610002000000620000",
|
14
|
+
"canonical_extjson": "{\"a\" : \"b\"}"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"description": "Multi-character",
|
18
|
+
"canonical_bson": "190000000261000D0000006162616261626162616261620000",
|
19
|
+
"canonical_extjson": "{\"a\" : \"abababababab\"}"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"description": "two-byte UTF-8 (\u00e9)",
|
23
|
+
"canonical_bson": "190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000",
|
24
|
+
"canonical_extjson": "{\"a\" : \"\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\"}"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"description": "three-byte UTF-8 (\u2606)",
|
28
|
+
"canonical_bson": "190000000261000D000000E29886E29886E29886E298860000",
|
29
|
+
"canonical_extjson": "{\"a\" : \"\\u2606\\u2606\\u2606\\u2606\"}"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"description": "Embedded nulls",
|
33
|
+
"canonical_bson": "190000000261000D0000006162006261620062616261620000",
|
34
|
+
"canonical_extjson": "{\"a\" : \"ab\\u0000bab\\u0000babab\"}"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"description": "Required escapes",
|
38
|
+
"canonical_bson" : "320000000261002600000061625C220102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F61620000",
|
39
|
+
"canonical_extjson" : "{\"a\":\"ab\\\\\\\"\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001fab\"}"
|
40
|
+
}
|
41
|
+
],
|
42
|
+
"decodeErrors": [
|
43
|
+
{
|
44
|
+
"description": "bad string length: 0 (but no 0x00 either)",
|
45
|
+
"bson": "0C0000000261000000000000"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"description": "bad string length: -1",
|
49
|
+
"bson": "0C000000026100FFFFFFFF00"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"description": "bad string length: eats terminator",
|
53
|
+
"bson": "10000000026100050000006200620000"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"description": "bad string length: longer than rest of document",
|
57
|
+
"bson": "120000000200FFFFFF00666F6F6261720000"
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"description": "string is not null-terminated",
|
61
|
+
"bson": "1000000002610004000000616263FF00"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"description": "empty string, but extra null",
|
65
|
+
"bson": "0E00000002610001000000000000"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"description": "invalid UTF-8",
|
69
|
+
"bson": "0E00000002610002000000E90000"
|
70
|
+
}
|
71
|
+
]
|
72
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
{
|
2
|
+
"description": "Symbol",
|
3
|
+
"bson_type": "0x0E",
|
4
|
+
"deprecated": true,
|
5
|
+
"test_key": "a",
|
6
|
+
"valid": [
|
7
|
+
{
|
8
|
+
"description": "Empty string",
|
9
|
+
"canonical_bson": "0D0000000E6100010000000000",
|
10
|
+
"canonical_extjson": "{\"a\": {\"$symbol\": \"\"}}",
|
11
|
+
"converted_bson": "0D000000026100010000000000",
|
12
|
+
"converted_extjson": "{\"a\": \"\"}"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"description": "Single character",
|
16
|
+
"canonical_bson": "0E0000000E610002000000620000",
|
17
|
+
"canonical_extjson": "{\"a\": {\"$symbol\": \"b\"}}",
|
18
|
+
"converted_bson": "0E00000002610002000000620000",
|
19
|
+
"converted_extjson": "{\"a\": \"b\"}"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"description": "Multi-character",
|
23
|
+
"canonical_bson": "190000000E61000D0000006162616261626162616261620000",
|
24
|
+
"canonical_extjson": "{\"a\": {\"$symbol\": \"abababababab\"}}",
|
25
|
+
"converted_bson": "190000000261000D0000006162616261626162616261620000",
|
26
|
+
"converted_extjson": "{\"a\": \"abababababab\"}"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"description": "two-byte UTF-8 (\u00e9)",
|
30
|
+
"canonical_bson": "190000000E61000D000000C3A9C3A9C3A9C3A9C3A9C3A90000",
|
31
|
+
"canonical_extjson": "{\"a\": {\"$symbol\": \"éééééé\"}}",
|
32
|
+
"converted_bson": "190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000",
|
33
|
+
"converted_extjson": "{\"a\": \"éééééé\"}"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"description": "three-byte UTF-8 (\u2606)",
|
37
|
+
"canonical_bson": "190000000E61000D000000E29886E29886E29886E298860000",
|
38
|
+
"canonical_extjson": "{\"a\": {\"$symbol\": \"☆☆☆☆\"}}",
|
39
|
+
"converted_bson": "190000000261000D000000E29886E29886E29886E298860000",
|
40
|
+
"converted_extjson": "{\"a\": \"☆☆☆☆\"}"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"description": "Embedded nulls",
|
44
|
+
"canonical_bson": "190000000E61000D0000006162006261620062616261620000",
|
45
|
+
"canonical_extjson": "{\"a\": {\"$symbol\": \"ab\\u0000bab\\u0000babab\"}}",
|
46
|
+
"converted_bson": "190000000261000D0000006162006261620062616261620000",
|
47
|
+
"converted_extjson": "{\"a\": \"ab\\u0000bab\\u0000babab\"}"
|
48
|
+
}
|
49
|
+
],
|
50
|
+
"decodeErrors": [
|
51
|
+
{
|
52
|
+
"description": "bad symbol length: 0 (but no 0x00 either)",
|
53
|
+
"bson": "0C0000000261000000000000"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"description": "bad symbol length: -1",
|
57
|
+
"bson": "0C000000026100FFFFFFFF00"
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"description": "bad symbol length: eats terminator",
|
61
|
+
"bson": "10000000026100050000006200620000"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"description": "bad symbol length: longer than rest of document",
|
65
|
+
"bson": "120000000200FFFFFF00666F6F6261720000"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"description": "symbol is not null-terminated",
|
69
|
+
"bson": "1000000002610004000000616263FF00"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"description": "empty symbol, but extra null",
|
73
|
+
"bson": "0E00000002610001000000000000"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"description": "invalid UTF-8",
|
77
|
+
"bson": "0E00000002610002000000E90000"
|
78
|
+
}
|
79
|
+
]
|
80
|
+
}
|