[mongoose] DeprecationWarning: current URL string parser is deprecated 오류 해결 방법
몽구스 버전 업데이트 이후 다시 접속을 하려 해보니
오류메세지가 바뀌었다
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
(node:2672) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2672) 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.
파싱 문제였다.
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import mongoose from 'mongoose';
mongoose
.connect("mongodb+srv://[사용자]:[암호]@cheesustudy.ujge0.mongodb.net/[db]?retryWrites=true&w=majority", {
useNewUrlParser: true,
useCreateIndex: true,
})
.then(() => {
console.log("Connected to MongoDB");
})
.catch((err) => {
console.log(err);
});
|
cs |
이렇게 바꿔주면 된다.
'Yame Programmer > MongoDB' 카테고리의 다른 글
[atlas] MongoError: user is not allowed to do action [find] on (0) | 2021.02.14 |
---|---|
[mongoose] MongoParseError: URI does not have hostname, domain name and tld (0) | 2021.02.14 |
[mongoose] srv 접속 오류 (0) | 2021.02.14 |
[MongoDB] 기본 명령어 (0) | 2017.03.07 |