You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug? bug What is the current behavior? includes() different behaviors If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
it should be the same behavior. What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
nodejs v10.22.0
mongoose v5.5.15 && v5.7.1
mongodb v3.4.6
I took a closer look and this is an unintended consequence of #7798 in v5.6.0: as of v5.6.0, user3.friends.map() returns a Mongoose array rather than a vanilla array, and Mongoose arrays support searching for documents by their _id. We intend to change this behavior in v6.0, see #8356. But changing it in a minor release seems a bit too heavy.
As a workaround, you can do const ids = [].concat(user3.friends.map(u=> u._id)); to ensure that you get a vanilla JavaScript array.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
includes()
different behaviorsIf the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
it should be the same behavior.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
nodejs v10.22.0
mongoose v5.5.15 && v5.7.1
mongodb v3.4.6
I had checked the release log but didn't found any breaking changes.
Since https://github.com/Automattic/mongoose/blob/master/History.md#554--2019-04-25 v5.5.4 already supported
#includes()
, so why it has different behaviors?The text was updated successfully, but these errors were encountered: