From e142aad49ca8055aadeff2daef54e05f41349acc Mon Sep 17 00:00:00 2001 From: hasezoey Date: Fri, 8 Jul 2022 14:37:48 +0200 Subject: [PATCH 1/3] style(schema): add "String[]" to available types for "pre" and "post" fixes #11989 --- lib/schema.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/schema.js b/lib/schema.js index 26144de75a5..14f7df2e9c4 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -1577,7 +1577,7 @@ Schema.prototype.queue = function(name, args) { * // Runs when you call `doc.deleteOne()` * }); * - * @param {String|RegExp} The method name or regular expression to match method name + * @param {String|RegExp|String[]} The method name or regular expression to match method name * @param {Object} [options] * @param {Boolean} [options.document] If `name` is a hook for both document and query middleware, set to `true` to run on document middleware. For example, set `options.document` to `true` to apply this hook to `Document#deleteOne()` rather than `Query#deleteOne()`. * @param {Boolean} [options.query] If `name` is a hook for both document and query middleware, set to `true` to run on query middleware. @@ -1633,7 +1633,7 @@ Schema.prototype.pre = function(name) { * console.log('this fires after the post find hook'); * }); * - * @param {String|RegExp} The method name or regular expression to match method name + * @param {String|RegExp|String[]} The method name or regular expression to match method name * @param {Object} [options] * @param {Boolean} [options.document] If `name` is a hook for both document and query middleware, set to `true` to run on document middleware. * @param {Boolean} [options.query] If `name` is a hook for both document and query middleware, set to `true` to run on query middleware. From 03eab94b7ceed8e175d1be5184ee2d8ac7984af0 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Fri, 8 Jul 2022 14:41:22 +0200 Subject: [PATCH 2/3] style(schema): add proper parameter name for "pre" and "post" fixes #11989 --- lib/schema.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/schema.js b/lib/schema.js index 14f7df2e9c4..c716c36844c 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -1577,7 +1577,7 @@ Schema.prototype.queue = function(name, args) { * // Runs when you call `doc.deleteOne()` * }); * - * @param {String|RegExp|String[]} The method name or regular expression to match method name + * @param {String|RegExp|String[]} name The method name or regular expression to match method name * @param {Object} [options] * @param {Boolean} [options.document] If `name` is a hook for both document and query middleware, set to `true` to run on document middleware. For example, set `options.document` to `true` to apply this hook to `Document#deleteOne()` rather than `Query#deleteOne()`. * @param {Boolean} [options.query] If `name` is a hook for both document and query middleware, set to `true` to run on query middleware. @@ -1633,7 +1633,7 @@ Schema.prototype.pre = function(name) { * console.log('this fires after the post find hook'); * }); * - * @param {String|RegExp|String[]} The method name or regular expression to match method name + * @param {String|RegExp|String[]} name The method name or regular expression to match method name * @param {Object} [options] * @param {Boolean} [options.document] If `name` is a hook for both document and query middleware, set to `true` to run on document middleware. * @param {Boolean} [options.query] If `name` is a hook for both document and query middleware, set to `true` to run on query middleware. From 6cec77e5091d137bd6b16f5e850efad18fcd0747 Mon Sep 17 00:00:00 2001 From: Hafez Date: Fri, 8 Jul 2022 15:31:43 +0200 Subject: [PATCH 3/3] Apply suggestions from code review --- lib/schema.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/schema.js b/lib/schema.js index c716c36844c..b38045b66f7 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -1577,7 +1577,7 @@ Schema.prototype.queue = function(name, args) { * // Runs when you call `doc.deleteOne()` * }); * - * @param {String|RegExp|String[]} name The method name or regular expression to match method name + * @param {String|RegExp|String[]} methodName The method name or regular expression to match method name * @param {Object} [options] * @param {Boolean} [options.document] If `name` is a hook for both document and query middleware, set to `true` to run on document middleware. For example, set `options.document` to `true` to apply this hook to `Document#deleteOne()` rather than `Query#deleteOne()`. * @param {Boolean} [options.query] If `name` is a hook for both document and query middleware, set to `true` to run on query middleware. @@ -1633,7 +1633,7 @@ Schema.prototype.pre = function(name) { * console.log('this fires after the post find hook'); * }); * - * @param {String|RegExp|String[]} name The method name or regular expression to match method name + * @param {String|RegExp|String[]} methodName The method name or regular expression to match method name * @param {Object} [options] * @param {Boolean} [options.document] If `name` is a hook for both document and query middleware, set to `true` to run on document middleware. * @param {Boolean} [options.query] If `name` is a hook for both document and query middleware, set to `true` to run on query middleware.