1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
195
  
196
  
197
  
198
  
199
  
200
  
201
  
202
  
203
  
204
  
205
  
206
  
207
  
208
  
209
  
210
  
211
  
212
  
213
  
214
  
215
  
216
  
217
  
218
  
219
  
220
  
221
  
222
  
223
  
224
  
225
  
226
  
227
  
228
  
229
  
230
  
231
  
232
  
233
  
234
  
235
  
236
  
237
  
{ 
    "description": "Top-level document validity", 
    "bson_type": "0x00", 
    "valid": [ 
        { 
            "description": "Document with keys that start with $", 
            "canonical_bson": "0F00000010246B6579002A00000000", 
            "canonical_extjson": "{\"$key\": {\"$numberInt\": \"42\"}}" 
        } 
    ], 
    "decodeErrors": [ 
        { 
            "description": "An object size that's too small to even include the object size, but is a well-formed, empty object", 
            "bson": "0100000000" 
        }, 
        { 
            "description": "An object size that's only enough for the object size, but is a well-formed, empty object", 
            "bson": "0400000000" 
        }, 
        { 
            "description": "One object, with length shorter than size (missing EOO)", 
            "bson": "05000000" 
        }, 
        { 
            "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x01", 
            "bson": "0500000001" 
        }, 
        { 
            "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0xff", 
            "bson": "05000000FF" 
        }, 
        { 
            "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x70", 
            "bson": "0500000070" 
        }, 
        { 
            "description": "Byte count is zero (with non-zero input length)", 
            "bson": "00000000000000000000" 
        }, 
        { 
            "description": "Stated length exceeds byte count, with truncated document", 
            "bson": "1200000002666F6F0004000000626172" 
        }, 
        { 
            "description": "Stated length less than byte count, with garbage after envelope", 
            "bson": "1200000002666F6F00040000006261720000DEADBEEF" 
        }, 
        { 
            "description": "Stated length exceeds byte count, with valid envelope", 
            "bson": "1300000002666F6F00040000006261720000" 
        }, 
        { 
            "description": "Stated length less than byte count, with valid envelope", 
            "bson": "1100000002666F6F00040000006261720000" 
        }, 
        { 
            "description": "Invalid BSON type low range", 
            "bson": "07000000000000" 
        }, 
        { 
            "description": "Invalid BSON type high range", 
            "bson": "07000000800000" 
        }, 
        { 
            "description": "Document truncated mid-key", 
            "bson": "1200000002666F" 
        } 
    ], 
    "parseErrors": [ 
        { 
            "description" : "Bad $regularExpression (extra field)", 
            "string" : "{\"a\" : \"$regularExpression\": {\"pattern\": \"abc\", \"options\": \"\", \"unrelated\": true}}}" 
        }, 
        { 
            "description" : "Bad $regularExpression (missing options field)", 
            "string" : "{\"a\" : \"$regularExpression\": {\"pattern\": \"abc\"}}}" 
        }, 
        { 
            "description": "Bad $regularExpression (pattern is number, not string)", 
            "string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": 42, \"$options\" : \"\"}}}" 
        }, 
        { 
            "description": "Bad $regularExpression (options are number, not string)", 
            "string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": \"a\", \"$options\" : 0}}}" 
        }, 
        { 
            "description" : "Bad $regularExpression (missing pattern field)", 
            "string" : "{\"a\" : \"$regularExpression\": {\"options\":\"ix\"}}}" 
        }, 
        { 
            "description": "Bad $oid (number, not string)", 
            "string": "{\"a\" : {\"$oid\" : 42}}" 
        }, 
        { 
            "description": "Bad $oid (extra field)", 
            "string": "{\"a\" : {\"$oid\" : \"56e1fc72e0c917e9c4714161\", \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad $numberInt (number, not string)", 
            "string": "{\"a\" : {\"$numberInt\" : 42}}" 
        }, 
        { 
            "description": "Bad $numberInt (extra field)", 
            "string": "{\"a\" : {\"$numberInt\" : \"42\", \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad $numberLong (number, not string)", 
            "string": "{\"a\" : {\"$numberLong\" : 42}}" 
        }, 
        { 
            "description": "Bad $numberLong (extra field)", 
            "string": "{\"a\" : {\"$numberLong\" : \"42\", \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad $numberDouble (number, not string)", 
            "string": "{\"a\" : {\"$numberDouble\" : 42}}" 
        }, 
        { 
            "description": "Bad $numberDouble (extra field)", 
            "string": "{\"a\" : {\"$numberDouble\" : \".1\", \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad $numberDecimal (number, not string)", 
            "string": "{\"a\" : {\"$numberDecimal\" : 42}}" 
        }, 
        { 
            "description": "Bad $numberDecimal (extra field)", 
            "string": "{\"a\" : {\"$numberDecimal\" : \".1\", \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad $binary (binary is number, not string)", 
            "string": "{\"x\" : {\"$binary\" : {\"base64\" : 0, \"subType\" : \"00\"}}}" 
        }, 
        { 
            "description": "Bad $binary (type is number, not string)", 
            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"\", \"subType\" : 0}}}" 
        }, 
        { 
            "description": "Bad $binary (missing $type)", 
            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\"}}}" 
        }, 
        { 
            "description": "Bad $binary (missing $binary)", 
            "string": "{\"x\" : {\"$binary\" : {\"subType\" : \"00\"}}}" 
        }, 
        { 
            "description": "Bad $binary (extra field)", 
            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\", \"subType\" : 0, \"unrelated\": true}}}" 
        }, 
        { 
            "description": "Bad $code (type is number, not string)", 
            "string": "{\"a\" : {\"$code\" : 42}}" 
        }, 
        { 
            "description": "Bad $code (extra field)", 
            "string": "{\"a\" : {\"$code\" : \"\", \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad $code with $scope (scope is number, not doc)", 
            "string": "{\"x\" : {\"$code\" : \"\", \"$scope\" : 42}}" 
        }, 
        { 
            "description": "Bad $timestamp (type is number, not doc)", 
            "string": "{\"a\" : {\"$timestamp\" : 42} }" 
        }, 
        { 
            "description": "Bad $timestamp ('t' type is string, not number)", 
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : 42} } }" 
        }, 
        { 
            "description": "Bad $timestamp ('i' type is string, not number)", 
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : \"42\"} } }" 
        }, 
        { 
            "description": "Bad $timestamp (extra field at same level as $timestamp)", 
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : \"42\"}, \"unrelated\": true } }" 
        }, 
        { 
            "description": "Bad $timestamp (extra field at same level as t and i)", 
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : \"42\", \"unrelated\": true} } }" 
        }, 
        { 
            "description": "Bad $timestamp (missing t)", 
            "string": "{\"a\" : {\"$timestamp\" : {\"i\" : \"42\"} } }" 
        }, 
        { 
            "description": "Bad $timestamp (missing i)", 
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\"} } }" 
        }, 
        { 
            "description": "Bad $date (number, not string or hash)", 
            "string": "{\"a\" : {\"$date\" : 42}}" 
        }, 
        { 
            "description": "Bad $date (extra field)", 
            "string": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"1356351330501\"}, \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad DBRef (ref is number, not string)", 
            "string": "{\"x\" : {\"$ref\" : 42, \"$id\" : \"abc\"}}" 
        }, 
        { 
            "description": "Bad DBRef (db is number, not string)", 
            "string": "{\"x\" : {\"$ref\" : \"a\", \"$id\" : \"abc\", \"$db\" : 42}}" 
        }, 
        { 
            "description": "Bad $minKey (boolean, not integer)", 
            "string": "{\"a\" : {\"$minKey\" : true}}" 
        }, 
        { 
            "description": "Bad $minKey (wrong integer)", 
            "string": "{\"a\" : {\"$minKey\" : 0}}" 
        }, 
        { 
            "description": "Bad $minKey (extra field)", 
            "string": "{\"a\" : {\"$minKey\" : 1, \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad $maxKey (boolean, not integer)", 
            "string": "{\"a\" : {\"$maxKey\" : true}}" 
        }, 
        { 
            "description": "Bad $maxKey (wrong integer)", 
            "string": "{\"a\" : {\"$maxKey\" : 0}}" 
        }, 
        { 
            "description": "Bad $maxKey (extra field)", 
            "string": "{\"a\" : {\"$maxKey\" : 1, \"unrelated\": true}}" 
        }, 
        { 
            "description": "Bad DBpointer (extra field)", 
            "string": "{\"a\": {\"$dbPointer\": {\"a\": {\"$numberInt\": \"1\"}, \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}, \"c\": {\"$numberInt\": \"2\"}, \"$ref\": \"b\"}}}" 
        } 
 
    ] 
}