我有参考错误与 Mongoose ?

b1payxdu  于 2022-11-13  发布在  Go
关注(0)|答案(1)|浏览(116)
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;
ca1c2owp

ca1c2owp1#

如果您使用的是Mongoose v6+,则应删除userNewUrlParseruseUnifiedTopology
请尝试以下操作:

connect( 'mongodb://127.0.0.1:27017/socialNetwork);

相关问题