Mongoose Schema Array element getter is not called, when it should be #9889
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When using getters inside schema types, if the property of the schema is an
Array
, getter of an element is not called when it should beIf the current behavior is a bug, please provide the steps to reproduce.
https://gist.github.com/ahmednaser94/f0b2e10fb4927da28dbec6d48fdd465a
What is the expected behavior?
It should call
get:
ofgroups
property andcreatedBy
property of user modelExpected log in terminal
What actually happen in 2 different scenarios
it prints
It didn't call
get:
ofgroups
property!, but calledget:
ofcreatedBy
_id
usingfindById
methodit prints
It didn't call
get:
ofgroups
property also!, but calledset:
instead !!!why
set:
of groups called!! it should callget:
notset:
it only calls
get:
insidecreatedBy
, but not insidegroups
Also, be noted that,
createdBy
is one ObjectID, butgroups
is array of ObjectIDWhat are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
The text was updated successfully, but these errors were encountered: