1BSON::Bytes(3)        User Contributed Perl Documentation       BSON::Bytes(3)
2
3
4

NAME

6       BSON::Bytes - BSON type wrapper for binary byte strings
7

VERSION

9       version v1.12.2
10

SYNOPSIS

12           use BSON::Types ':all';
13
14           $bytes = bson_bytes( $bytestring );
15           $bytes = bson_bytes( $bytestring, $subtype );
16

DESCRIPTION

18       This module provides a BSON type wrapper for binary data represented as
19       a string of bytes.
20

ATTRIBUTES

22   data
23       A scalar, interpreted as bytes.  (I.e. "character" data should be
24       encoded to bytes.)  It defaults to the empty string.
25
26   subtype
27       A numeric BSON subtype between 0 and 255.  This defaults to 0 and
28       generally should not be modified.  Subtypes 128 to 255 are "user-
29       defined".
30

METHODS

32   TO_JSON
33       Returns Base64 encoded string equivalent to the data attribute.
34
35       If the "BSON_EXTJSON" option is true, it will instead be compatible
36       with MongoDB's extended JSON
37       <https://github.com/mongodb/specifications/blob/master/source/extended-
38       json.rst> format, which represents it as a document as follows:
39
40           {"$binary" : { "base64": "<base64 data>", "subType" : "<type>"} }
41

OVERLOADING

43       The stringification operator ("") is overloaded to return the binary
44       data and fallback overloading is enabled.
45

AUTHORS

47       •   David Golden <david@mongodb.com>
48
49       •   Stefan G. <minimalist@lavabit.com>
50
52       This software is Copyright (c) 2020 by Stefan G. and MongoDB, Inc.
53
54       This is free software, licensed under:
55
56         The Apache License, Version 2.0, January 2004
57
58
59
60perl v5.36.0                      2023-01-20                    BSON::Bytes(3)
Impressum