인프런 커뮤니티 질문&답변

고용수님의 프로필 이미지
고용수

작성한 질문수

mongoDB 기초부터 실무까지(feat. Node.js)

Nesting 성능 테스트

faker2를 통해 blog. comment 생성 시도시의 오류

작성

·

201

0

Error: Blog validation failed: comments.blog: Path `comments.blog` is required., comments.user: Path `comments.user` is required., comments.content: Path `comments.content` is required.
    at ValidationError.inspect (/Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/error/validation.js:48:26)
    at formatValue (node:internal/util/inspect:782:19)
    at inspect (node:internal/util/inspect:347:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2167:40)
    at formatWithOptions (node:internal/util/inspect:2029:10)
    at console.value (node:internal/console/constructor:324:14)
    at console.log (node:internal/console/constructor:360:61)
    at /Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/src/routes/blogRoute.js:26:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: {
    'comments.blog': ValidatorError: Path `comments.blog` is required.
        at validate (/Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/schematype.js:1330:13)
        at SchemaType.doValidate (/Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/schematype.js:1314:7)
        at /Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/document.js:2762:18
        at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
      properties: [Object],
      kind: 'required',
      path: 'comments.blog',
      value: undefined,
      reason: undefined,
      [Symbol(mongoose:validatorError)]: true
    },
    'comments.user': ValidatorError: Path `comments.user` is required.
        at validate (/Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/schematype.js:1330:13)
        at SchemaType.doValidate (/Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/schematype.js:1314:7)
        at /Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/document.js:2762:18
        at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
      properties: [Object],
      kind: 'required',
      path: 'comments.user',
      value: undefined,
      reason: undefined,
      [Symbol(mongoose:validatorError)]: true
    },
    'comments.content': ValidatorError: Path `comments.content` is required.
        at validate (/Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/schematype.js:1330:13)
        at SchemaType.doValidate (/Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/schematype.js:1314:7)
        at /Users/yungsu2391naver.com/Desktop/mongodb_nodejs tutorial/inflearn_nodejs-mongodb/node_modules/mongoose/lib/document.js:2762:18
        at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
      properties: [Object],
      kind: 'required',
      path: 'comments.content',
      value: undefined,
      reason: undefined,
      [Symbol(mongoose:validatorError)]: true
    }
  },
  _message: 'Blog validation failed'
}

답변

답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!
고용수님의 프로필 이미지
고용수

작성한 질문수

질문하기