I have a collection created for maintaining ticket_no
, for which document looks like this,
{
id:"TICKET_ID",
TICKET_NO:7
}
Now, when I try to findOneAndUpdate for a ticket_id
, incrementing TICKET_NO
by 1,
function get(){
var ret = Sequence.findOneAndUpdate(
{
query: { _id: 'TICKET_ID' },
update: { $inc: { TICKET_NO: 1 } },
new: true
}
);
console.log(ret.TICKET_NO)
return ret.TICKET_NO;
}
The function returns null
value instead of ticket no