board.js_4

김형우·2021년 12월 28일
0

node.js

목록 보기
9/26

조회수 증가 - PUT

// 변경하기 updateOne({조건}, {변경할내용})
const result = await coll.updateOne( { _id : no }, { $inc : {hit : 1} } );


console.log(result);
CMD>

{
acknowledged: true,
modifiedCount: 1,
upsertedId: null,
upsertedCount: 0,
matchedCount: 1
}

modifiedCount 사용

if(result.modifiedCount === 1){
            return res.send({status:200});
        }
return res.send({status:-1});
    
profile
The best

0개의 댓글