app.post("/add", function (요청, 응답) {
응답.send("전송완료");
db.collection("counter").findOne(
{ name: "게시물갯수" },
function (에러, 결과) {
console.log(결과.totalPost);
var 총게시물갯수 = 결과.totalPost;
db.collection("post").insertOne(
{
_id: 총게시물갯수 + 1,
이름: 요청.body.이메일,
비번: 요청.body.비밀번호,
},
function (에러, 결과) {
console.log("저장완료");
//counter라는 콜렉션에 있는 totalPost 라는 항목도 1증가 시켜야함
db.collection("counter").updateOne(
{ name: "게시물갯수" },
{ $inc: { totalPost: 1 } }
);
}
);
}
);
});
열심히 따라 가기만해서 그런지 어디서 뭔가 잘못됬는데 어떻게 고쳐야할지 감이 오질 않습니다



마지막 처럼 나와야하는데 아이디 번호만 나오고, DB에선 글번호로 저장이 되지 않고 있습니다 어디를 고쳐야할까요 ?