...

Text file src/go.mongodb.org/mongo-driver/testdata/bson-corpus/binary.json

Documentation: go.mongodb.org/mongo-driver/testdata/bson-corpus

     1{
     2    "description": "Binary type",
     3    "bson_type": "0x05",
     4    "test_key": "x",
     5    "valid": [
     6        {
     7            "description": "subtype 0x00 (Zero-length)",
     8            "canonical_bson": "0D000000057800000000000000",
     9            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"\", \"subType\" : \"00\"}}}"
    10        },
    11        {
    12            "description": "subtype 0x00 (Zero-length, keys reversed)",
    13            "canonical_bson": "0D000000057800000000000000",
    14            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"\", \"subType\" : \"00\"}}}",
    15            "degenerate_extjson": "{\"x\" : { \"$binary\" : {\"subType\" : \"00\", \"base64\" : \"\"}}}"
    16        },
    17        {
    18            "description": "subtype 0x00",
    19            "canonical_bson": "0F0000000578000200000000FFFF00",
    20            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"00\"}}}"
    21        },
    22        {
    23            "description": "subtype 0x01",
    24            "canonical_bson": "0F0000000578000200000001FFFF00",
    25            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"01\"}}}"
    26        },
    27        {
    28            "description": "subtype 0x02",
    29            "canonical_bson": "13000000057800060000000202000000FFFF00",
    30            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"02\"}}}"
    31        },
    32        {
    33            "description": "subtype 0x03",
    34            "canonical_bson": "1D000000057800100000000373FFD26444B34C6990E8E7D1DFC035D400",
    35            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"03\"}}}"
    36        },
    37        {
    38            "description": "subtype 0x04",
    39            "canonical_bson": "1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400",
    40            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"04\"}}}"
    41        },
    42        {
    43            "description": "subtype 0x04 UUID",
    44            "canonical_bson": "1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400",
    45            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"04\"}}}",
    46            "degenerate_extjson": "{\"x\" : { \"$uuid\" : \"73ffd264-44b3-4c69-90e8-e7d1dfc035d4\"}}"
    47        },
    48        {
    49            "description": "subtype 0x05",
    50            "canonical_bson": "1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400",
    51            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"05\"}}}"
    52        },
    53        {
    54            "description": "subtype 0x07",
    55            "canonical_bson": "1D000000057800100000000773FFD26444B34C6990E8E7D1DFC035D400",
    56            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"07\"}}}"
    57        },
    58        {
    59            "description": "subtype 0x08",
    60            "canonical_bson": "1D000000057800100000000873FFD26444B34C6990E8E7D1DFC035D400",
    61            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"08\"}}}"
    62        },
    63        {
    64            "description": "subtype 0x80",
    65            "canonical_bson": "0F0000000578000200000080FFFF00",
    66            "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"80\"}}}"
    67        },
    68        {
    69            "description": "$type query operator (conflicts with legacy $binary form with $type field)",
    70            "canonical_bson": "1F000000037800170000000224747970650007000000737472696E67000000",
    71            "canonical_extjson": "{\"x\" : { \"$type\" : \"string\"}}"
    72        },
    73        {
    74            "description": "$type query operator (conflicts with legacy $binary form with $type field)",
    75            "canonical_bson": "180000000378001000000010247479706500020000000000",
    76            "canonical_extjson": "{\"x\" : { \"$type\" : {\"$numberInt\": \"2\"}}}"
    77        }
    78    ],
    79    "decodeErrors": [
    80        {
    81            "description": "Length longer than document",
    82            "bson": "1D000000057800FF0000000573FFD26444B34C6990E8E7D1DFC035D400"
    83        },
    84        {
    85            "description": "Negative length",
    86            "bson": "0D000000057800FFFFFFFF0000"
    87        },
    88        {
    89            "description": "subtype 0x02 length too long ",
    90            "bson": "13000000057800060000000203000000FFFF00"
    91        },
    92        {
    93            "description": "subtype 0x02 length too short",
    94            "bson": "13000000057800060000000201000000FFFF00"
    95        },
    96        {
    97            "description": "subtype 0x02 length negative one",
    98            "bson": "130000000578000600000002FFFFFFFFFFFF00"
    99        }
   100    ],
   101    "parseErrors": [
   102        {
   103            "description": "$uuid wrong type",
   104            "string": "{\"x\" : { \"$uuid\" : { \"data\" : \"73ffd264-44b3-4c69-90e8-e7d1dfc035d4\"}}}"
   105        },
   106        {
   107            "description": "$uuid invalid value--too short",
   108            "string": "{\"x\" : { \"$uuid\" : \"73ffd264-44b3-90e8-e7d1dfc035d4\"}}"
   109        },
   110        {
   111            "description": "$uuid invalid value--too long",
   112            "string": "{\"x\" : { \"$uuid\" : \"73ffd264-44b3-4c69-90e8-e7d1dfc035d4-789e4\"}}"
   113        },
   114        {
   115            "description": "$uuid invalid value--misplaced hyphens",
   116            "string": "{\"x\" : { \"$uuid\" : \"73ff-d26444b-34c6-990e8e-7d1dfc035d4\"}}"
   117        },
   118        {
   119            "description": "$uuid invalid value--too many hyphens",
   120            "string": "{\"x\" : { \"$uuid\" : \"----d264-44b3-4--9-90e8-e7d1dfc0----\"}}"
   121        }
   122    ]
   123}

View as plain text