Skip to content

Commit

Permalink
docs: fix inverted explanation of justOne option for populate
Browse files Browse the repository at this point in the history
Fix #12599
  • Loading branch information
vkarpov15 committed Nov 12, 2022
1 parent d98b285 commit ed6740f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/model.js
Expand Up @@ -4556,7 +4556,7 @@ Model.validate = function validate(obj, pathsToValidate, context, callback) {
* - match: optional query conditions to match
* - model: optional name of the model to use for population
* - options: optional query options like sort, limit, etc
* - justOne: optional boolean, if true Mongoose will always set `path` to an array. Inferred from schema by default.
* - justOne: optional boolean, if true Mongoose will always set `path` to a document or `null`. If false, Mongoose will always set `path` to a potentially empty array. Inferred from schema by default.
* - strictPopulate: optional boolean, set to `false` to allow populating paths that aren't in the schema.
*
* #### Example:
Expand Down
5 changes: 3 additions & 2 deletions types/populate.d.ts
Expand Up @@ -26,8 +26,9 @@ declare module 'mongoose' {
/** deep populate */
populate?: string | PopulateOptions | (string | PopulateOptions)[];
/**
* If true Mongoose will always set `path` to an array, if false Mongoose will
* always set `path` to a document. Inferred from schema by default.
* If true Mongoose will always set `path` to a document or `null`.
* If false Mongoose will always set `path` to a potentially empty array.
* Inferred from schema by default.
*/
justOne?: boolean;
/** transform function to call on every populated doc */
Expand Down

0 comments on commit ed6740f

Please sign in to comment.