본문 바로가기
Database

Mongoose - current URL string parser is deprecated

by e-pd 2020. 9. 19.
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이 발생하지 않는다.

'Database' 카테고리의 다른 글

mysql - 이모지저장  (0) 2020.01.04
오라클 튜닝-22  (0) 2019.12.21
Postgresql - 나누기  (0) 2019.12.18
Postgresql - 날짜의 요일가져오기  (2) 2019.12.16
오라클 튜닝-21  (0) 2019.12.14