I have this code:
function incrementarValor (sequenceName){
contador.findOneAndUpdate(
{_id: sequenceName},
{$inc:{sequence_value:1}},
{new:true},
function(err, valor){
return valor.sequence_value;
})}
I need this function returns a value of a document, when I test it ,if i try to print, it works but when i try to returns the function give me a undefind
someone know what is happening?