정의
cursor.readConcern(level)중요
Mongo쉬 방법
This page documents a
mongoshmethod. This is not the documentation for a language-specific driver, such as Node.js.MongoDB API 드라이버의 경우 언어별 MongoDB 드라이버 설명서를 참조하세요.
메서드에 대한 읽기 고려
db.collection.find()(read concern) 를 지정합니다.The
readConcern()method has the following form:db.collection.find().readConcern(<level>) The
readConcern()method has the following parameter:Parameter유형설명level문자열
가능한 읽기 고려 수준은 다음과 같습니다.
"local"이는 프라이머리 및 보조 노드에 대한 읽기 작업의 읽기 고려 수준입니다."available"입니다. 프라이머리 및 세컨더리에 대한 읽기 작업에 사용할 수 있습니다."available"은 프라이머리 및 비 샤드형 세컨더리에 대해"local"과 동일하게 동작합니다. 쿼리는 인스턴스의 가장 최근 데이터를 반환합니다."majority". WiredTiger 스토리지 엔진을 사용하는 복제본 세트에 사용할 수 있습니다."linearizable".primary의 읽기 작업에만 사용할 수 있습니다."snapshot". 다중 문서 트랜잭션 및 다중 문서 트랜잭션 외부의 특정 읽기 작업에 사용할 수 있습니다.
읽기 고려 수준에 대한 자세한 내용은 읽기 고려 수준을 참조하세요.
호환성
이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- 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의 소스 사용 가능 무료 자체 관리 버전
고려 사항
자체 쓰기 읽기
쓰기에서 승인을 요청하는 경우 인과적으로 일관된 세션을 사용하여 자신의 쓰기를 읽을 수 있습니다.
선형화 가능한 읽기 고려 (read concern) 성능
linearizable read concern 지정할 때 대부분의 데이터 보유 멤버를 사용할 수 없는 경우 항상 maxTimeMS() 를 사용합니다.
db.restaurants.find( { _id: 5 } ).readConcern("linearizable").maxTimeMS(10000)