-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MongooseArray#map()
, #filter()
, etc. should return vanilla JS arrays
#8356
Comments
See #8351 |
I am not familiar with all the uses of connecting an array to the parent document, but one way I would think about it is that: If an array method returns entirely different values of the array items (such as Is there more to it than just the type, functionality-wise? |
The only purpose of Mongoose arrays is to track changes and store them correctly in the parent document - if there isn't a parent document, there isn't much Mongoose arrays do that's useful. The only public functions I can find for mongoose arrays that aren't on vanilla JS arrays are Maybe instead of returning a vanilla JS array, we should return an array that has |
… array rather than a headless Mongoose array Re: #8356
After more careful consideration, I think @AbdelrahmanHafez is right in that you should be able to modify subdocuments like |
As opposed to Mongoose arrays. These methods create new arrays rather than modifying the existing array, and the newly created array isn't connected to a document. So we should consider making these methods return a vanilla JS array.
The text was updated successfully, but these errors were encountered: