Skip to content

Commit

Permalink
fix(document+model): add populate option to populate() API docs
Browse files Browse the repository at this point in the history
Fix #11170
  • Loading branch information
vkarpov15 committed Feb 17, 2022
1 parent 24ae2f0 commit 07afbd5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -4118,6 +4118,7 @@ Document.prototype.equals = function(doc) {
* @param {Object} [match] Conditions for the population query
* @param {Object} [options] Options for the population query (sort, etc)
* @param {String} [options.path=null] The path to populate.
* @param {string|PopulateOptions} [options.populate=null] Recursively populate paths in the populated documents. See [deep populate docs](/docs/populate.html#deep-populate).
* @param {boolean} [options.retainNullValues=false] by default, Mongoose removes null and undefined values from populated arrays. Use this option to make `populate()` retain `null` and `undefined` array entries.
* @param {boolean} [options.getters=false] if true, Mongoose will call any getters defined on the `localField`. By default, Mongoose gets the raw value of `localField`. For example, you would need to set this option to `true` if you wanted to [add a `lowercase` getter to your `localField`](/docs/schematypes.html#schematype-options).
* @param {boolean} [options.clone=false] When you do `BlogPost.find().populate('author')`, blog posts with the same author will share 1 copy of an `author` doc. Enable this option to make Mongoose clone populated docs before assigning them.
Expand Down
1 change: 1 addition & 0 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -4406,6 +4406,7 @@ Model.validate = function validate(obj, pathsToValidate, context, callback) {
* @param {Document|Array} docs Either a single document or array of documents to populate.
* @param {Object|String} options Either the paths to populate or an object specifying all parameters
* @param {string} [options.path=null] The path to populate.
* @param {string|PopulateOptions} [options.populate=null] Recursively populate paths in the populated documents. See [deep populate docs](/docs/populate.html#deep-populate).
* @param {boolean} [options.retainNullValues=false] By default, Mongoose removes null and undefined values from populated arrays. Use this option to make `populate()` retain `null` and `undefined` array entries.
* @param {boolean} [options.getters=false] If true, Mongoose will call any getters defined on the `localField`. By default, Mongoose gets the raw value of `localField`. For example, you would need to set this option to `true` if you wanted to [add a `lowercase` getter to your `localField`](/docs/schematypes.html#schematype-options).
* @param {boolean} [options.clone=false] When you do `BlogPost.find().populate('author')`, blog posts with the same author will share 1 copy of an `author` doc. Enable this option to make Mongoose clone populated docs before assigning them.
Expand Down

0 comments on commit 07afbd5

Please sign in to comment.