1
문서를 복사하려고합니다. 처음에 찾았습니다. 그런 다음 _id를 제거하십시오. 그런 다음 삽입하십시오. 하지만 계산은 여전히 진행 중입니다. 중복 오류가 발생합니다. 내가 도대체 뭘 잘못하고있는 겁니까?몽구스 (mongo), 문서 복사
mongoose.model('calculations').findOne({calcId:req.params.calcId}, function(){
if(err) handleErr(err, res, 'Something went wrong when trying to find calculation by id');
delete calculation._id;
console.log(calculation); //The _.id is still there
mongoose.model('calculations').create(calculation, function(err, stat){
if(err) handleErr(err, res, 'Something went wrong when trying to copy a calculation');
res.send(200);
})
});