Skip to content

Commit

Permalink
fix(schematype): consistently set wasPopulated to object with `valu…
Browse files Browse the repository at this point in the history
…e` property rather than boolean

Re: #14418
Re: #6048
vkarpov15 committed Mar 21, 2024
1 parent ed35573 commit bc48379
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/schematype.js
Original file line number Diff line number Diff line change
@@ -1505,7 +1505,7 @@ SchemaType.prototype._castRef = function _castRef(value, doc, init) {
}

if (value.$__ != null) {
value.$__.wasPopulated = value.$__.wasPopulated || true;
value.$__.wasPopulated = value.$__.wasPopulated || { value: value._id };
return value;
}

@@ -1531,7 +1531,7 @@ SchemaType.prototype._castRef = function _castRef(value, doc, init) {
!doc.$__.populated[path].options.options ||
!doc.$__.populated[path].options.options.lean) {
ret = new pop.options[populateModelSymbol](value);
ret.$__.wasPopulated = true;
ret.$__.wasPopulated = { value: ret._id };
}

return ret;

0 comments on commit bc48379

Please sign in to comment.