Given is an array with book objects, where each status
has to be updated:
var books = [
{ id: '58b2e58', status: 'pending' },
{ id: '5903703', status: 'pending' }
]
var status = {status: 'accepted'}
I tried this:
Book.update(books, status).exec(function afterwards(err, updatedbooks) {
if (err) {
res.json(err)
}
console.log("updatedbooks:", updatedbooks);
});
but the 'updatedbooks' log is empty. When checking in mongodb, the books are there, I can find them with Book.find(books);
As here mentioned this here works fine, but I want to have beside the ID's also the status=="pending" in the WHERE criteria.