Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1000 from jcrugzz/master

Specifying BSON SubType for the toObject() method in MongooseBuffer
  • Loading branch information...
commit 750ab5009ae3950b1fcf06811ffcb2911061cc25 2 parents 5656142 + 056d7bf
@aheckmann aheckmann authored
Showing with 12 additions and 3 deletions.
  1. +12 −3 lib/types/buffer.js
View
15 lib/types/buffer.js
@@ -153,13 +153,22 @@ MongooseBuffer.prototype.copy = function (target) {
/**
* Returns a Binary.
- *
+ * @param {Hex} BSON SubType
+ * SubTypes:
+ * 0x00: Binary/Generic
+ * 0x01: Function
+ * 0x02: Binary (Deprecated, 0x00 is new default)
+ * 0x03: UUID
+ * 0x04: MD5
+ * 0x80: User Defined
+ * More info here: http://bsonspec.org/#/specification
* @return {Buffer}
* @api public
*/
-MongooseBuffer.prototype.toObject = function () {
- return new Binary(this, 0x00);
+MongooseBuffer.prototype.toObject = function (subtype) {
+ subtype = typeof subtype !== 'undefined' ? subtype : 0x00
+ return new Binary(this, subtype);
};
/**
Please sign in to comment.
Something went wrong with that request. Please try again.