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 := 2BSON binary subtype. Depreated, do not use.
- BIN_FUNCTION
const static Int BIN_FUNCTION := 1BSON binary subtype.
- BIN_GENERIC
const static Int BIN_GENERIC := 0BSON binary subtype. The default subtype.
- BIN_MD5
const static Int BIN_MD5 := 5BSON binary subtype.
- BIN_USER
const static Int BIN_USER := 128BSON binary subtype.
- BIN_UUID
const static Int BIN_UUID := 4BSON binary subtype.
- BIN_UUID_OLD
const static Int BIN_UUID_OLD := 3BSON 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
Binaryinstance, the data in the givenBufwill be cleared. See Buf docs for more info.- subtype
const Int subtypeThe binary subtype
- toJs
Str toJs()Returns a Mongo Shell compliant, JavaScript representation of the
Binary. Example:binary.toJs
// --> BinData(0, "emVyb0Nvb2w=")