본문 바로가기
tech documents/memo

mongoDB collection 이름이 복수형으로 바뀔때

by kimtahen 2022. 3. 3.
반응형

서론

mongoDB collection의 기본 naming convention은 소문자의 복수형이다. 그렇기 때문에 특정해주지 않으면 자동으로 db상에 복수형으로 저장이 된다.

해결법

mongoose.model('post', postSchema, 'post');

이처럼 collection name을 3번째 인자로 넘겨주면 된다

반응형

'tech documents > memo' 카테고리의 다른 글

github 특정 파일 모든 commit에서 삭제 하기  (0) 2022.03.02
Ubuntu에서 폰트 설치하는 방법  (0) 2022.02.11
makefile  (0) 2022.02.09
Alacritty 터미널 설치하기  (0) 2022.02.07

댓글