1{
2 "description": "Javascript Code with Scope",
3 "bson_type": "0x0F",
4 "test_key": "a",
5 "valid": [
6 {
7 "description": "Empty code string, empty scope",
8 "canonical_bson": "160000000F61000E0000000100000000050000000000",
9 "canonical_extjson": "{\"a\" : {\"$code\" : \"\", \"$scope\" : {}}}"
10 },
11 {
12 "description": "Non-empty code string, empty scope",
13 "canonical_bson": "1A0000000F610012000000050000006162636400050000000000",
14 "canonical_extjson": "{\"a\" : {\"$code\" : \"abcd\", \"$scope\" : {}}}"
15 },
16 {
17 "description": "Empty code string, non-empty scope",
18 "canonical_bson": "1D0000000F61001500000001000000000C000000107800010000000000",
19 "canonical_extjson": "{\"a\" : {\"$code\" : \"\", \"$scope\" : {\"x\" : {\"$numberInt\": \"1\"}}}}"
20 },
21 {
22 "description": "Non-empty code string and non-empty scope",
23 "canonical_bson": "210000000F6100190000000500000061626364000C000000107800010000000000",
24 "canonical_extjson": "{\"a\" : {\"$code\" : \"abcd\", \"$scope\" : {\"x\" : {\"$numberInt\": \"1\"}}}}"
25 },
26 {
27 "description": "Unicode and embedded null in code string, empty scope",
28 "canonical_bson": "1A0000000F61001200000005000000C3A9006400050000000000",
29 "canonical_extjson": "{\"a\" : {\"$code\" : \"\\u00e9\\u0000d\", \"$scope\" : {}}}"
30 }
31 ],
32 "decodeErrors": [
33 {
34 "description": "field length zero",
35 "bson": "280000000F6100000000000500000061626364001300000010780001000000107900010000000000"
36 },
37 {
38 "description": "field length negative",
39 "bson": "280000000F6100FFFFFFFF0500000061626364001300000010780001000000107900010000000000"
40 },
41 {
42 "description": "field length too short (less than minimum size)",
43 "bson": "160000000F61000D0000000100000000050000000000"
44 },
45 {
46 "description": "field length too short (truncates scope)",
47 "bson": "280000000F61001F0000000500000061626364001300000010780001000000107900010000000000"
48 },
49 {
50 "description": "field length too long (clips outer doc)",
51 "bson": "280000000F6100210000000500000061626364001300000010780001000000107900010000000000"
52 },
53 {
54 "description": "field length too long (longer than outer doc)",
55 "bson": "280000000F6100FF0000000500000061626364001300000010780001000000107900010000000000"
56 },
57 {
58 "description": "bad code string: length too short",
59 "bson": "280000000F6100200000000400000061626364001300000010780001000000107900010000000000"
60 },
61 {
62 "description": "bad code string: length too long (clips scope)",
63 "bson": "280000000F6100200000000600000061626364001300000010780001000000107900010000000000"
64 },
65 {
66 "description": "bad code string: negative length",
67 "bson": "280000000F610020000000FFFFFFFF61626364001300000010780001000000107900010000000000"
68 },
69 {
70 "description": "bad code string: length longer than field",
71 "bson": "280000000F610020000000FF00000061626364001300000010780001000000107900010000000000"
72 },
73 {
74 "description": "bad scope doc (field has bad string length)",
75 "bson": "1C0000000F001500000001000000000C000000020000000000000000"
76 }
77 ]
78}
View as plain text