我有一个为维护而创建的集合ticket_no
,其文档如下所示,
{
id:"TICKET_ID",
TICKET_NO:7
}
现在,当我尝试为 a 查找 OneAndUpdate 时ticket_id
,以 1 递增TICKET_NO
,
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;
}
该函数返回null
值而不是ticket no