Do you want to request a feature or report a bug?
Bug
What is the current behavior?
If a sub-document is null and there is a virtual on it the sub-document is initialized as an object with the virtual instead of stay null
If the current behavior is a bug, please provide the steps to reproduce.
Consider the following setup:
As you can see I expect that child field will be null but actually the value is: { parentName: 'Homer Simpson' }.
If I tweak the create a bit like that:
Do you want to request a feature or report a bug? Bug
What is the current behavior? If a sub-document is null and there is a virtual on it the sub-document is initialized as an object with the virtual instead of stay null
If the current behavior is a bug, please provide the steps to reproduce. Consider the following setup:
And the following
run
function:As you can see I expect that
child
field will benull
but actually the value is:{ parentName: 'Homer Simpson' }
. If I tweak thecreate
a bit like that:Then I get a runtime error
Cannot read properties of null
which is even worst.What is the expected behavior? I expect that if a field is
null
then no virtual should run on it.