更新时间:2023-02-04 08:57:05
要连接至mongodb
与mongoose
一起使用,可以使用:
To connect to mongodb
with mongoose
, you can use :
mongoose.connect('mongodb://localhost/users_test');
或
mongoose.connect('localhost/users_test');
或
mongoose.connect('localhost','users_test');
但不是mongoose.connect('mongodb:localhost/users_test');
,它与正确的主机名(mongodb
而不是localhost
)不匹配
But not mongoose.connect('mongodb:localhost/users_test');
, it doesnt match the right hostname (mongodb
instead of localhost
)