Skip to content

Commit

Permalink
style(model): remove some more jsdoc "callback" references
Browse files Browse the repository at this point in the history
also combine "always true" paths for "aggregate"
  • Loading branch information
hasezoey committed Dec 14, 2024
1 parent 6874338 commit 3d45e47
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,7 @@ Model.$where = function $where() {
/**
* Issues a mongodb findOneAndUpdate command.
*
* Finds a matching document, updates it according to the `update` arg, passing any `options`, and returns the found document (if any) to the callback. The query executes if `callback` is passed else a Query object is returned.
* Finds a matching document, updates it according to the `update` arg, passing any `options`. A Query object is returned.
*
* #### Example:
*
Expand Down Expand Up @@ -3992,7 +3992,7 @@ function _update(model, op, conditions, doc, options) {
/**
* Performs [aggregations](https://www.mongodb.com/docs/manual/aggregation/) on the models collection.
*
* If a `callback` is passed, the `aggregate` is executed and a `Promise` is returned. If a callback is not passed, the `aggregate` itself is returned.
* The `aggregate` itself is returned.
*
* This function triggers the following middleware.
*
Expand Down Expand Up @@ -4047,10 +4047,6 @@ Model.aggregate = function aggregate(pipeline, options) {
aggregate.option(options);
}

if (typeof callback === 'undefined') {
return aggregate;
}

return aggregate;
};

Expand Down Expand Up @@ -4238,7 +4234,6 @@ Model.validate = async function validate(obj, pathsOrOptions, context) {
* @param {Object} [options.options=null] Additional options like `limit` and `lean`.
* @param {Function} [options.transform=null] Function that Mongoose will call on every populated document that allows you to transform the populated document.
* @param {Boolean} [options.forceRepopulate=true] Set to `false` to prevent Mongoose from repopulating paths that are already populated
* @param {Function} [callback(err,doc)] Optional callback, executed upon completion. Receives `err` and the `doc(s)`.
* @return {Promise}
* @api public
*/
Expand Down

0 comments on commit 3d45e47

Please sign in to comment.