Mongodb – set all fields in subdocument to false, then set the second one to true in a single query
Suppose I have the following the document structure. [ { "_id": 1, "depots": [ { "_id": 1, "isFavourite": true }, { "_id": 2, "isFavourite": false }, { "_id": 3, "isFavourite": true }, { "_id": 4, "isFavourite": false } ] }…