Gunakan $inc operator.
db.yourcollection.update({ /* find options */ }, { $inc: {piecesLeft : -1 } });
Diperbarui:
db.yourcollection.update({
_id: '572f16440a0dbb1e0cc02201', // Find updated item e.g. by _id
piecesLeft: { $gt: 0 } // Update only if piecesLeft > 0
}, {
$inc: {
piecesLeft: -1 // Increment by -1
}
});