const classafBson::Binary
sys::Obj afBson::Binary
@
Serializable { simple=true }
(BSON Type) - Wraps binary data and its subType. Subtypes from zero to 127 are predefined or reserved. Subtypes from 128-255 are user-defined.
Binary objects with a default subtype of BIN_GENERIC
will be read and returned as a Buf.
- BIN_BINARY_OLD
const static Int BIN_BINARY_OLD := 2
BSON binary subtype. Depreated, do not use.
- BIN_FUNCTION
const static Int BIN_FUNCTION := 1
BSON binary subtype.
- BIN_GENERIC
const static Int BIN_GENERIC := 0
BSON binary subtype. The default subtype.
- BIN_MD5
const static Int BIN_MD5 := 5
BSON binary subtype.
- BIN_USER
const static Int BIN_USER := 128
BSON binary subtype.
- BIN_UUID
const static Int BIN_UUID := 4
BSON binary subtype.
- BIN_UUID_OLD
const static Int BIN_UUID_OLD := 3
BSON binary subtype. Depreated, do not use.
- data
The binary data
- make
new make(Buf data, Int subtype := @BIN_GENERIC)
Creates a BSON Binary instance.
Note that by creating a
Binary
instance, the data in the givenBuf
will be cleared. See Buf docs for more info.- subtype
const Int subtype
The binary subtype
- toJs
Str toJs()
Returns a Mongo Shell compliant, JavaScript representation of the
Binary
. Example:binary.toJs
// --> BinData(0, "emVyb0Nvb2w=")