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

Source

const static Int BIN_BINARY_OLD := 2

BSON binary subtype. Depreated, do not use.

BIN_FUNCTION

Source

const static Int BIN_FUNCTION := 1

BSON binary subtype.

BIN_GENERIC

Source

const static Int BIN_GENERIC := 0

BSON binary subtype. The default subtype.

BIN_MD5

Source

const static Int BIN_MD5 := 5

BSON binary subtype.

BIN_USER

Source

const static Int BIN_USER := 128

BSON binary subtype.

BIN_UUID

Source

const static Int BIN_UUID := 4

BSON binary subtype.

BIN_UUID_OLD

Source

const static Int BIN_UUID_OLD := 3

BSON binary subtype. Depreated, do not use.

data

Source

@Transient
const Buf data

The binary data

make

Source

new make(Buf data, Int subtype := @BIN_GENERIC)

Creates a BSON Binary instance.

Note that by creating a Binary instance, the data in the given Buf will be cleared. See Buf docs for more info.

subtype

Source

const Int subtype

The binary subtype

toJs

Source

Str toJs()

Returns a Mongo Shell compliant, JavaScript representation of the Binary. Example:

binary.toJs  // --> BinData(0, "emVyb0Nvb2w=")

See MongoDB Extended JSON.