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 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.toObject(bson.BSON_BINARY_SUBTYPE_USER_DEFINED);

MongooseBuffer.mixin.write()

Type:
  • «property»

Writes the buffer.