CoreMongooseArray.includes not working correctly since version 5.6.0 #8203
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?
CoreMongooseArray incorrectly/incompletely implements "includes" method since version 5.6.0.
If the current behavior is a bug, please provide the steps to reproduce.
https://gist.github.com/hellivan/0d3ce7722d6add10eab83bbfbca52cc5
What is the expected behavior?
Should print:
"includes" should return false, since 'foo' is not included in friends array after index 1.
But instead following content is logged:
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Mongoose: 5.6.0, 5.6.9, 5.7.2
Node: 8.16.0 12.3.1
The bug was possibly introduced by commit 97c4666 which introduced
lib/types/core_array.js
.Since CoreMongooseArray extends Array type and Array.prototype.includes accepts a second parameter
fromIndex
according to the specs , implementation was incomplete from the beginning.The text was updated successfully, but these errors were encountered: