Skip to content

Commit bc48379

Browse files
committedMar 21, 2024·
fix(schematype): consistently set wasPopulated to object with value property rather than boolean
Re: #14418 Re: #6048
1 parent ed35573 commit bc48379

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎lib/schematype.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ SchemaType.prototype._castRef = function _castRef(value, doc, init) {
15051505
}
15061506

15071507
if (value.$__ != null) {
1508-
value.$__.wasPopulated = value.$__.wasPopulated || true;
1508+
value.$__.wasPopulated = value.$__.wasPopulated || { value: value._id };
15091509
return value;
15101510
}
15111511

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

15371537
return ret;

0 commit comments

Comments
 (0)
Please sign in to comment.