![](/img/trans.png)
[英]Why the length of a collection schema doesn't change after deleting the data in mongodb collection using mongoose?
[英]Why doesn't load data into my collection? mongodb
这是出现在我的 mongo 数据库中的内容:
这是我的 app.post 插入数据,当我提交它时 console.log 带有日期的 object 但使用 create 它只是说“null”->
App listening on port 4000
{ '”title”': 'adaw', '”body”': 'dwdw' }
null { _id: new ObjectId("6274a7a58d8946ca10ae57c4"), __v: 0 }
app.post('/posts/store',(req,res)=>{
console.log(req.body)
BlogPost.create(req.body,(error,blogpost) =>{
console.log(error,blogpost)
res.redirect('/')
})
})`
使用insertOne
而不是create
来插入数据库
这是官方文档站点
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.