복붙노트

[MONGODB] MongoError 다음 '커서'옵션은 설명 인수로 집계을 제외하고, 필요

MONGODB

MongoError 다음 '커서'옵션은 설명 인수로 집계을 제외하고, 필요

난 다음 오류가 발생 한 후 MongoDB를 3.6의 최신 버전을 사용하고 있습니다 ...

MongoError: The 'cursor' option is required, except for aggregate with the explain argument
const user = await User.aggregate([
      { $group: {
          _id: '$_id',
          domain: { $push: "$domain" },
          domain: { $push: "$email" },
          domain: { $push: "$userName" }
        }
      }
    ])

해결법

  1. ==============================

    1.감사합니다 @Neil 룬

    감사합니다 @Neil 룬

    업데이트 몽구스. 5.0 이전 몽구스 버전이 잘못 MongoDB를 3.6 일치합니다. MongoDB를 3.6 "전용 커서"를 "선택 커서"에서 총 API를 변경, 세 몽구스 버전은 응답 배열을 요청하기 위해 사용되지 않는 방법의 호출하여 휴식.

  2. from https://stackoverflow.com/questions/50101104/mongoerror-the-cursor-option-is-required-except-for-aggregate-with-the-expla by cc-by-sa and MIT license