Wanna React 로고 이미지

menu-opener icon
  • 홈
  • 태그
  • 방명록
  • Team Github 바로가기
mongoose 에러 핸들링 포스팅 썸네일 이미지

원두마켓

mongoose 에러 핸들링

Built-in Validator export const UserSchema = new Schema( { userId: { type: String, unique: true, required: true, match: /[a-z0-9_]{4,16}/, }, ... } ); mongoose Schema를 작성할 때, 각각의 field에 대해 validator를 지정할 수 있으며, 각각의 validator를 통과하지 못하면 에러를 발생시킨다. 이 때 Path `userId` is required가 오류 메시지이며, 이 오류 메시지를 Array Syntax로 간단하게 커스텀할 수 있다. export const UserSchema = new Schema( { userId: { type: String, unique:..

2022.04.03 게시됨

1

공지사항

최근글

인기글

최근 작성된 댓글

태그 클라우드

  • husky
  • Number
  • 없애기
  • input
  • 입력
  • 에러처리
  • 에러핸들링
  • git hooks
  • 0
  • 제거
  • 앞
  • next.js
  • MongoDB
  • mongoose
Copyright . 베이스캠프 all rights reserved.
Designed by 베이스캠프
닫기 아이콘
사이드 프로필 배경이미지
블로그 이미지

Lahee

  • 분류 전체보기 (7)
    • 팀 소개 (1)
    • 원두마켓 (6)
    • 랜덤 interview (0)

전체

오늘

어제

Designed by 베이스캠프

티스토리툴바