저장을 습관화
NestJS - mongoose 사용 시 useNewUrlParser 옵션 설정 본문
관련 공식 문서
https://mongoosejs.com/docs/migrating_to_6.html#no-more-deprecation-warning-options
Mongoose v7.5.3: Migrating to Mongoose 6
Please note: we plan to discontinue Mongoose 5 support on March 1, 2024. Please see our version support guide. There are several backwards-breaking changes you should be aware of when migrating from Mongoose 5.x to Mongoose 6.x. If you're still on Mongoose
mongoosejs.com
mongoose 6.0 미만에서는 아래와 같이 넣어줘야할 옵션이 있었다
각각의 옵션은 아래와 같은 역할을 하였다
useNewUrlParser: mongodb url을 읽을 수 있도록 설정
useUnifiedTopology: 최신 mongodb 드라이버 엔진을 사용하도록 설정
useCreateIndex: mongodb에서 인덱스를 생성함
useFindAndModify: findOneAndUpdate(), findOneAndDelete() 메소드에서 findAndModify 기능을 사용할지 여부
이 옵션들은 mongoose 6.0 버전부터 기본 지원, 혹은 더 이상 지원되지 않게 되었다.
특히 useNewUrlParser와 같은 경우, 등록 시 에러가 발생하므로 반드시 지워주어야 한다.
'{ useNewUrlParser: boolean; }' 형식의 인수는 'MongooseModuleOptions' 형식의 매개 변수에 할당될 수 없습니다. 개체 리터럴은 알려진 속성만 지정할 수 있으며 'MongooseModuleOptions' 형식에 'useNewUrlParse'이(가) 없습니다.
'공부 > node.js' 카테고리의 다른 글
에러 기록 - export class Cat extends Document... ReferenceError: Document is not defined (0) | 2023.10.02 |
---|---|
NestJS - .env (0) | 2023.10.01 |
pipe와 middleware의 차이점 (0) | 2023.09.30 |
express - 미들웨어 작성 기초 (0) | 2023.09.29 |
Nest.JS로 API 만들기 - 1 (0) | 2023.09.06 |