使用mongoose连接成功并成功创建集合但是插入数据就报错
**解决办法:
mongoose.connect('mongodb://root:root@localhost/test?authSource=admin', { useUnifiedTopology: true, useNewUrlParser: true })
.then(() => console.log("数据库连接成功"))
.catch(err => console.log(err, "数据库连接失败"))
使用mongoose连接成功并成功创建集合但是插入数据就报错
**解决办法:
mongoose.connect('mongodb://root:root@localhost/test?authSource=admin', { useUnifiedTopology: true, useNewUrlParser: true })
.then(() => console.log("数据库连接成功"))
.catch(err => console.log(err, "数据库连接失败"))