Skip to content

Commit

Permalink
Merge branch 'master' into gh-13032
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Feb 15, 2023
2 parents 0bc7e5e + 06585a8 commit 5f315c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ of middleware: document middleware, model middleware, aggregate middleware, and

Document middleware is supported for the following document functions.
In Mongoose, a document is an instance of a `Model` class.
In document middleware functions, `this` refers to the document.
In document middleware functions, `this` refers to the document. To access the model, use `this.constructor`.

* [validate](api/document.html#document_Document-validate)
* [save](api/model.html#model_Model-save)
Expand Down
4 changes: 2 additions & 2 deletions lib/schema/uuid.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Binary = MongooseBuffer.Binary;

function hex2buffer(hex) {
// use buffer built-in function to convert from hex-string to buffer
const buff = Buffer.from(hex, 'hex');
const buff = hex != null && Buffer.from(hex, 'hex');
return buff;
}

Expand All @@ -36,7 +36,7 @@ function hex2buffer(hex) {

function binary2hex(buf) {
// use buffer built-in function to convert from buffer to hex-string
const hex = buf.toString('hex');
const hex = buf != null && buf.toString('hex');
return hex;
}

Expand Down

0 comments on commit 5f315c4

Please sign in to comment.