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