Database
Mongoose - current URL string parser is deprecated
e-pd
2020. 9. 19. 16:58
mongoose.connect(URL);
Mongoose로 DB 커넥션을 하고, 콘솔창을 보면
DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(node:45041) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
이런식으로 현재 쓰는 기능이 Deprecation되었으니 변경해달라는 메시지가 나온다. 현재는 warning이지만 미래 버젼에서는 이렇게 못쓴다는 의미이고, 대처방법은 콘솔로그에 그대로 나와있다.
mongoose.connect(URL, { useNewUrlParser: true, useUnifiedTopology: true });
이렇게 값을 넘겨주면 warning이 발생하지 않는다.