lundi 9 mars 2015

Elegant way to increment a mongoose number field

What is the most elegant way to increment a mongoose number's field ?



var Book = new Schema({
name: String,
total: Number
})


How do i increment it in the API?



var book = new Book({
name: req.body.name,
total: ?
});

book.save(callback);

Aucun commentaire:

Enregistrer un commentaire