target «Buffer» Copies the buffer.
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.
other «Buffer» Determines if this buffer is equals to other buffer
subtype «Hex» Sets the subtype option and marks the buffer modified.
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);
Converts this buffer for storage in MongoDB, including subtype
[subtype] «Hex» Converts this buffer to its Binary type representation.
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);
Writes the buffer.
© 2010 LearnBoost
Licensed under the MIT License.
https://mongoosejs.com/docs/api/buffer.html