Buffer


MongooseBuffer.mixin.copy()

Parameters:
  • target Β«BufferΒ»
Returns:
  • Β«numberΒ» The number of bytes copied.
Type:
  • Β«propertyΒ»

Copies the buffer.

Note:

Buffer#copy does not mark target as modified so you must copy from a MongooseBuffer for it to work as expected. This is a work around since copy modifies the target, not this.


MongooseBuffer.mixin.equals()

Parameters:
  • other Β«BufferΒ»
Returns:
  • Β«booleanΒ»

Determines if this buffer is equals to other buffer


MongooseBuffer.mixin.subtype()

Parameters:
  • subtype Β«HexΒ»
See:

Sets the subtype option and marks the buffer modified.

SubTypes:

const bson = require('bson')
bson.BSON_BINARY_SUBTYPE_DEFAULT
bson.BSON_BINARY_SUBTYPE_FUNCTION
bson.BSON_BINARY_SUBTYPE_BYTE_ARRAY
bson.BSON_BINARY_SUBTYPE_UUID
bson.BSON_BINARY_SUBTYPE_MD5
bson.BSON_BINARY_SUBTYPE_USER_DEFINED

doc.buffer.subtype(bson.BSON_BINARY_SUBTYPE_UUID);

MongooseBuffer.mixin.toBSON()

Returns:
  • Β«BinaryΒ»

Converts this buffer for storage in MongoDB, including subtype


MongooseBuffer.mixin.toObject()

Parameters:
  • [subtype] Β«HexΒ»
Returns:
  • Β«BinaryΒ»
See:

Converts this buffer to its Binary type representation.

SubTypes:

const mongodb = require('mongodb')
mongodb.BSON.BSON_BINARY_SUBTYPE_DEFAULT
mongodb.BSON.BSON_BINARY_SUBTYPE_FUNCTION
mongodb.BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY
mongodb.BSON.BSON_BINARY_SUBTYPE_UUID
mongodb.BSON.BSON_BINARY_SUBTYPE_MD5
mongodb.BSON.BSON_BINARY_SUBTYPE_USER_DEFINED
doc.buffer.toObject(mongodb.BSON.BSON_BINARY_SUBTYPE_USER_DEFINED);

MongooseBuffer.mixin.toUUID()

Returns:
  • Β«UUIDΒ»

Converts this buffer to a UUID. Throws an error if subtype is not 4.


MongooseBuffer.mixin.write()

Type:
  • Β«propertyΒ»

Writes the buffer.