cursor.isExhausted()중요
Mongo쉬 방법
This page documents a
mongoshmethod. This is not the documentation for a language-specific driver, such as Node.js.MongoDB API 드라이버의 경우 언어별 MongoDB 드라이버 설명서를 참조하세요.
반환합니다: 부울
cursor.isExhausted()returnsfalseif documents remain in the current document batch read by the cursor. Otherwise, returnstrue.
호환성
이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
참고
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
행동
테일 커서(tailable cursor)
tailable cursor( tailable cursor)와 함께 isExhausted() 을(를) 사용할 수 있습니다. tailable cursor는 현재 배치에 남아 있는 문서가 없더라도 열린 상태로 유지됩니다. 남아 있는 문서가 없으면 다른 커서가 자동으로 닫힙니다.
변경 스트림
change stream 에는 isExhausted() 을(를) 사용할 수 없습니다. 대신 다음을 검사합니다:
문서가 change stream 커서에 남아 있으면
cursor.tryNext()를 사용합니다.change stream 커서가 닫히면
cursor.isClosed()을(를) 사용합니다.
change stream 예시는 보기 예시 및 change stream 이미지 예시를 참조하세요.
예시
이 섹션에는 커서를 사용하여 기상 센서의 온도 측정값으로 collection에서 문서를 읽는 예가 포함되어 있습니다. isExhausted() 의 예가 표시됩니다.