Given is an array with book objects, where each status
has to be updated:
var bookCriterias = [
{ id: '58b2e58', status: 'pending' },
{ id: '5903703', status: 'pending' }
]
var status = {status: 'accepted'}
I tried this:
Book.update(bookCriterias, status).exec(function afterwards(err, updatedbooks) {
if (err) {
res.json(err)
}
console.log("updatedbooks:", updatedbooks);
});
But the updatedbooks is empty.
When I have the bookCriteria=['58b2e58','5903703'] like this, it will update all those books with the given ID's, but I want only update books with the status = pending!