{
"description": "Binary type",
"bson_type": "0x05",
"test_key": "x",
"valid": [
{
"description": "subtype 0x00 (Zero-length)",
"canonical_bson": "0D000000057800000000000000",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"\", \"subType\" : \"00\"}}}"
},
{
"description": "subtype 0x00 (Zero-length, keys reversed)",
"canonical_bson": "0D000000057800000000000000",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"\", \"subType\" : \"00\"}}}",
"degenerate_extjson": "{\"x\" : { \"$binary\" : {\"subType\" : \"00\", \"base64\" : \"\"}}}"
},
{
"description": "subtype 0x00",
"canonical_bson": "0F0000000578000200000000FFFF00",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"00\"}}}"
},
{
"description": "subtype 0x01",
"canonical_bson": "0F0000000578000200000001FFFF00",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"01\"}}}"
},
{
"description": "subtype 0x02",
"canonical_bson": "13000000057800060000000202000000FFFF00",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"02\"}}}"
},
{
"description": "subtype 0x03",
"canonical_bson": "1D000000057800100000000373FFD26444B34C6990E8E7D1DFC035D400",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"03\"}}}"
},
{
"description": "subtype 0x04",
"canonical_bson": "1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"04\"}}}"
},
{
"description": "subtype 0x05",
"canonical_bson": "1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"05\"}}}"
},
{
"description": "subtype 0x80",
"canonical_bson": "0F0000000578000200000080FFFF00",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"80\"}}}"
},
{
"description": "$type query operator (conflicts with legacy $binary form with $type field)",
"canonical_bson": "1F000000037800170000000224747970650007000000737472696E67000000",
"canonical_extjson": "{\"x\" : { \"$type\" : \"string\"}}"
},
{
"description": "$type query operator (conflicts with legacy $binary form with $type field)",
"canonical_bson": "180000000378001000000010247479706500020000000000",
"canonical_extjson": "{\"x\" : { \"$type\" : {\"$numberInt\": \"2\"}}}"
}
],
"decodeErrors": [
{
"description": "Length longer than document",
"bson": "1D000000057800FF0000000573FFD26444B34C6990E8E7D1DFC035D400"
},
{
"description": "Negative length",
"bson": "0D000000057800FFFFFFFF0000"
},
{
"description": "subtype 0x02 length too long ",
"bson": "13000000057800060000000203000000FFFF00"
},
{
"description": "subtype 0x02 length too short",
"bson": "13000000057800060000000201000000FFFF00"
},
{
"description": "subtype 0x02 length negative one",
"bson": "130000000578000600000002FFFFFFFFFFFF00"
}
]
}