const {connect, connection} = require('mongoose');
connect( 'mongodb://127.0.0.1:27017/socialNetwork',
{
userNewUrlParser: true,
useUnifiedTopology: true,
}
);
// use this to log mongo queries being exectuted!
mongoose.set('debug', true);
module.exports = connection;
1条答案
按热度按时间ca1c2owp1#
如果您使用的是Mongoose v6+,则应删除
userNewUrlParser
和useUnifiedTopology
。请尝试以下操作: