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 less than byte count, with garbage after envelope",
46            "bson": "1200000002666F6F00040000006261720000DEADBEEF"
47        },
48        {
49            "description": "Stated length exceeds byte count, with valid envelope",
50            "bson": "1300000002666F6F00040000006261720000"
51        },
52        {
53            "description": "Stated length less than byte count, with valid envelope",
54            "bson": "1100000002666F6F00040000006261720000"
55        },
56        {
57            "description": "Invalid BSON type low range",
58            "bson": "07000000000000"
59        },
60        {
61            "description": "Invalid BSON type high range",
62            "bson": "07000000800000"
63        },
64        {
65            "description": "Document truncated mid-key",
66            "bson": "1200000002666F"
67        }
68    ],
69    "parseErrors": [
70        {
71            "description" : "Bad $regularExpression (extra field)",
72            "string" : "{\"a\" : \"$regularExpression\": {\"pattern\": \"abc\", \"options\": \"\", \"unrelated\": true}}}"
73        },
74        {
75            "description" : "Bad $regularExpression (missing options field)",
76            "string" : "{\"a\" : \"$regularExpression\": {\"pattern\": \"abc\"}}}"
77        },
78        {
79            "description": "Bad $regularExpression (pattern is number, not string)",
80            "string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": 42, \"$options\" : \"\"}}}"
81        },
82        {
83            "description": "Bad $regularExpression (options are number, not string)",
84            "string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": \"a\", \"$options\" : 0}}}"
85        },
86        {
87            "description" : "Bad $regularExpression (missing pattern field)",
88            "string" : "{\"a\" : \"$regularExpression\": {\"options\":\"ix\"}}}"
89        },
90        {
91            "description": "Bad $oid (number, not string)",
92            "string": "{\"a\" : {\"$oid\" : 42}}"
93        },
94        {
95            "description": "Bad $oid (extra field)",
96            "string": "{\"a\" : {\"$oid\" : \"56e1fc72e0c917e9c4714161\", \"unrelated\": true}}"
97        },
98        {
99            "description": "Bad $numberInt (number, not string)",
100            "string": "{\"a\" : {\"$numberInt\" : 42}}"
101        },
102        {
103            "description": "Bad $numberInt (extra field)",
104            "string": "{\"a\" : {\"$numberInt\" : \"42\", \"unrelated\": true}}"
105        },
106        {
107            "description": "Bad $numberLong (number, not string)",
108            "string": "{\"a\" : {\"$numberLong\" : 42}}"
109        },
110        {
111            "description": "Bad $numberLong (extra field)",
112            "string": "{\"a\" : {\"$numberLong\" : \"42\", \"unrelated\": true}}"
113        },
114        {
115            "description": "Bad $numberDouble (number, not string)",
116            "string": "{\"a\" : {\"$numberDouble\" : 42}}"
117        },
118        {
119            "description": "Bad $numberDouble (extra field)",
120            "string": "{\"a\" : {\"$numberDouble\" : \".1\", \"unrelated\": true}}"
121        },
122        {
123            "description": "Bad $numberDecimal (number, not string)",
124            "string": "{\"a\" : {\"$numberDecimal\" : 42}}"
125        },
126        {
127            "description": "Bad $numberDecimal (extra field)",
128            "string": "{\"a\" : {\"$numberDecimal\" : \".1\", \"unrelated\": true}}"
129        },
130        {
131            "description": "Bad $binary (binary is number, not string)",
132            "string": "{\"x\" : {\"$binary\" : {\"base64\" : 0, \"subType\" : \"00\"}}}"
133        },
134        {
135            "description": "Bad $binary (type is number, not string)",
136            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"\", \"subType\" : 0}}}"
137        },
138        {
139            "description": "Bad $binary (missing $type)",
140            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\"}}}"
141        },
142        {
143            "description": "Bad $binary (missing $binary)",
144            "string": "{\"x\" : {\"$binary\" : {\"subType\" : \"00\"}}}"
145        },
146        {
147            "description": "Bad $binary (extra field)",
148            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\", \"subType\" : 0, \"unrelated\": true}}}"
149        },
150        {
151            "description": "Bad $code (type is number, not string)",
152            "string": "{\"a\" : {\"$code\" : 42}}"
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}
237