I would like to update with mongoose documents where the criteria is not something, I thought about something like this:
Candidate.update({candidateID: $not: {req.body.candidateID} }, {status: 'REJECTED'})
I don't think that it would work because $not
works with <operator-expression>
..
How can I achieve to update something like this?
In update query, the first part is to documents to be updated, and secand part is to specify the changes to the document given. In you case you have to use the operator $set
Candidate.update({candidateID: $not: {req.body.candidateID} }, {$set:{status: 'REJECTED'}})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.