0
我試圖使用貓鼬保存新記錄。我沒有在回調中獲取保存的文檔。貓鼬在回調中不返回保存的文檔
app.post("/register",(req,res) => {
let userData = req.body;
let user = new User(userData)
user.save().then((err,doc) => {
res.json({"success":true,"data":doc});
console.log(doc);
})
});
我正在接受文檔:1。雖然我應該得到整個文件。請幫幫我。
"dependencies": {
"body-parser": "^1.18.2",
"crypto-js": "^3.1.9-1",
"express": "^4.15.5",
"mongoose": "^4.11.13"
}
Lifesaver,thanks – raju