Greetings community.! I'm making a small application using node
and
mongoose
and I want to update a specific field of a document ie:
I have a document called Libro
with a property ejemplares_disponibles
of type number
, what I want to do is update that property every time a user loaned a book, something like: ejemplares_disponibles -= 1
. I tried the Libro.findByIdAndUpdate(id, {});
method but I do not know how to subtract -1 from that property.