Skip to content

Commit

Permalink
fix(populate): make error reported when no localField specified cat…
Browse files Browse the repository at this point in the history
…chable

Fix #6767
  • Loading branch information
vkarpov15 committed Jul 30, 2018
1 parent 1e27f09 commit e47b669
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions docs/source/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ function parse() {
}
}

if (ctx.string.includes('Model')) {
console.log(ctx);
}
console.log(ctx);

// Backwards compat
if (typeof ctx.constructor === 'string') {
Expand Down
2 changes: 1 addition & 1 deletion lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -3946,7 +3946,7 @@ function getModelsMapForPopulate(model, docs, options) {
}

if (virtual && (!localField || !foreignField)) {
throw new Error('If you are populating a virtual, you must set the ' +
return new Error('If you are populating a virtual, you must set the ' +
'localField and foreignField options');
}

Expand Down
2 changes: 2 additions & 0 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,8 @@ Query.prototype.wtimeout = function wtimeout(ms) {
*
* Read more about how to use read concern [here](https://docs.mongodb.com/manual/reference/read-concern/).
*
* @memberOf Query
* @method readConcern
* @param {String} level one of the listed read concern level or their aliases
* @see mongodb https://docs.mongodb.com/manual/reference/read-concern/
* @return {Query} this
Expand Down

0 comments on commit e47b669

Please sign in to comment.