'How to check if array contains new object?
I'm having this weird issue.
I connected a js app to a mongodb server in order to allow for collect cross referencing. I then store the new ObjectId in an array
like this
[
new ObjectId("62702f1e6b5b6ceaaa94b15b"),
new ObjectId("62702f1e6b5b6ceaaa94b15b")
]
Now I wanna get another item from the DB and check if its id is contained in the database
console.log(result[0].items.includes(otherres._id))
otherress is the item I wanna check for and result is housing the array which I wanna check However it is returned as false even tho it should be true
Can anyone help me with this ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
