Update field in array in mongoose
Hi, we are having trouble with updating a field in our database. We have a collection Game that consist of player1, player2, deck1, and deck2. Deck1 and deck2 are arrays with objects, where each object has an _id, name, link, and bool.
We want to update the bool field (to false) for a specific Game and specific object in deck1. We have the Game _id (roomId) and object _id (cardId). We have tried different solutions but none have worked. We think we should use findOneAndUpdate() or updatOne() but we can't figur out how to specify which card to change in deck1. Here is our latest try, which return null (both cardID and RoomId is correct, eg same as in the database).
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information