{
    "mode": "perldoc",
    "parameter": "BSON::Bytes",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/BSON%3A%3ABytes/json",
    "generated": "2026-06-09T12:58:56Z",
    "synopsis": "use BSON::Types ':all';\n$bytes = bsonbytes( $bytestring );\n$bytes = bsonbytes( $bytestring, $subtype );",
    "sections": {
        "NAME": {
            "content": "BSON::Bytes - BSON type wrapper for binary byte strings\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version v1.12.2\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use BSON::Types ':all';\n\n$bytes = bsonbytes( $bytestring );\n$bytes = bsonbytes( $bytestring, $subtype );\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides a BSON type wrapper for binary data represented as a string of bytes.\n",
            "subsections": []
        },
        "ATTRIBUTES": {
            "content": "data\nA scalar, interpreted as bytes. (I.e. \"character\" data should be encoded to bytes.) It defaults\nto the empty string.\n\nsubtype\nA numeric BSON subtype between 0 and 255. This defaults to 0 and generally should not be\nmodified. Subtypes 128 to 255 are \"user-defined\".\n",
            "subsections": []
        },
        "METHODS": {
            "content": "TOJSON\nReturns Base64 encoded string equivalent to the data attribute.\n\nIf the \"BSONEXTJSON\" option is true, it will instead be compatible with MongoDB's extended JSON\n<https://github.com/mongodb/specifications/blob/master/source/extended-json.rst> format, which\nrepresents it as a document as follows:\n\n{\"$binary\" : { \"base64\": \"<base64 data>\", \"subType\" : \"<type>\"} }\n",
            "subsections": []
        },
        "OVERLOADING": {
            "content": "The stringification operator (\"\") is overloaded to return the binary data and fallback\noverloading is enabled.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "*   David Golden <david@mongodb.com>\n\n*   Stefan G. <minimalist@lavabit.com>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is Copyright (c) 2020 by Stefan G. and MongoDB, Inc.\n\nThis is free software, licensed under:\n\nThe Apache License, Version 2.0, January 2004\n",
            "subsections": []
        }
    },
    "summary": "BSON::Bytes - BSON type wrapper for binary byte strings",
    "flags": [],
    "examples": [],
    "see_also": []
}