79 lines
3.5 KiB
JSON
79 lines
3.5 KiB
JSON
{
|
|
"description": "Javascript Code with Scope",
|
|
"bson_type": "0x0F",
|
|
"test_key": "a",
|
|
"valid": [
|
|
{
|
|
"description": "Empty code string, empty scope",
|
|
"canonical_bson": "160000000F61000E0000000100000000050000000000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"\", \"$scope\" : {}}}"
|
|
},
|
|
{
|
|
"description": "Non-empty code string, empty scope",
|
|
"canonical_bson": "1A0000000F610012000000050000006162636400050000000000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"abcd\", \"$scope\" : {}}}"
|
|
},
|
|
{
|
|
"description": "Empty code string, non-empty scope",
|
|
"canonical_bson": "1D0000000F61001500000001000000000C000000107800010000000000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"\", \"$scope\" : {\"x\" : {\"$numberInt\": \"1\"}}}}"
|
|
},
|
|
{
|
|
"description": "Non-empty code string and non-empty scope",
|
|
"canonical_bson": "210000000F6100190000000500000061626364000C000000107800010000000000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"abcd\", \"$scope\" : {\"x\" : {\"$numberInt\": \"1\"}}}}"
|
|
},
|
|
{
|
|
"description": "Unicode and embedded null in code string, empty scope",
|
|
"canonical_bson": "1A0000000F61001200000005000000C3A9006400050000000000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"\\u00e9\\u0000d\", \"$scope\" : {}}}"
|
|
}
|
|
],
|
|
"decodeErrors": [
|
|
{
|
|
"description": "field length zero",
|
|
"bson": "280000000F6100000000000500000061626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "field length negative",
|
|
"bson": "280000000F6100FFFFFFFF0500000061626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "field length too short (less than minimum size)",
|
|
"bson": "160000000F61000D0000000100000000050000000000"
|
|
},
|
|
{
|
|
"description": "field length too short (truncates scope)",
|
|
"bson": "280000000F61001F0000000500000061626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "field length too long (clips outer doc)",
|
|
"bson": "280000000F6100210000000500000061626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "field length too long (longer than outer doc)",
|
|
"bson": "280000000F6100FF0000000500000061626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "bad code string: length too short",
|
|
"bson": "280000000F6100200000000400000061626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "bad code string: length too long (clips scope)",
|
|
"bson": "280000000F6100200000000600000061626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "bad code string: negative length",
|
|
"bson": "280000000F610020000000FFFFFFFF61626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "bad code string: length longer than field",
|
|
"bson": "280000000F610020000000FF00000061626364001300000010780001000000107900010000000000"
|
|
},
|
|
{
|
|
"description": "bad scope doc (field has bad string length)",
|
|
"bson": "1C0000000F001500000001000000000C000000020000000000000000"
|
|
}
|
|
]
|
|
}
|