Skip to content

Commit

Permalink
Merge pull request #13638 from Automattic/IslandRhythms/gh-13501
Browse files Browse the repository at this point in the history
fix doc.validate doc
  • Loading branch information
vkarpov15 committed Jul 20, 2023
2 parents e48aa77 + 2fadab8 commit c44926c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -2521,21 +2521,17 @@ Document.prototype.isDirectSelected = function isDirectSelected(path) {
*
* #### Note:
*
* This method is called `pre` save and if a validation rule is violated, [save](https://mongoosejs.com/docs/api/model.html#Model.prototype.save()) is aborted and the error is returned to your `callback`.
* This method is called `pre` save and if a validation rule is violated, [save](https://mongoosejs.com/docs/api/model.html#Model.prototype.save()) is aborted and the error is thrown.
*
* #### Example:
*
* doc.validate(function (err) {
* if (err) handleError(err);
* else // validation passed
* });
* await doc.validate({ validateModifiedOnly: false, pathsToSkip: ['name', 'email']});
*
* @param {Array|String} [pathsToValidate] list of paths to validate. If set, Mongoose will validate only the modified paths that are in the given list.
* @param {Object} [options] internal options
* @param {Boolean} [options.validateModifiedOnly=false] if `true` mongoose validates only modified paths.
* @param {Array|string} [options.pathsToSkip] list of paths to skip. If set, Mongoose will validate every modified path that is not in this list.
* @param {Function} [callback] optional callback called after validation completes, passing an error if one occurred
* @return {Promise} Returns a Promise if no `callback` is given.
* @return {Promise} Returns a Promise.
* @api public
*/

Expand Down

0 comments on commit c44926c

Please sign in to comment.