[mongoose] MongoParseError: option useundefiedtopology is not supported

Wonhee Rhyu·2023년 6월 18일

몽고DB connection error: MongoParseError: option useundefiedtopology is not supported

mongoose.connect('mongodb://127.0.0.1:27017/todo-demo', {
  useNewUrlParser: true,
  useUndefiedTopology: true,
})
  .then(value => console.log('MongoDB 연결에 성공하였습니다.'))
  .catch(reason => console.log('MongoDB 연결에 실패하였습니다.'))

몽구스 최신버전으로 실행하면
connection error: MongoParseError: option useundefiedtopology is not supported
이런 에러가 나옴

몽구스 공식 홈페이지를 보면

No More Deprecation Warning Options
useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. Mongoose 6 always behaves as if useNewUrlParser, useUnifiedTopology, and useCreateIndex are true, and useFindAndModify is false. Please remove these options from your code.

몽구스 6버전부터는 해당 내용을 더이상 작성하지 않으면 됨
그리고 지금 몽구스는 7버전임..^^

profile
공부하면서 어려웠던 것들 정리

0개의 댓글