클래스: Mongo::BulkWrite
- 상속:
-
객체
- 객체
- Mongo::BulkWrite
- 확장자:
- 전달 가능
- 다음을 포함합니다.
- Operation::ResponseHandling
- 다음에 정의됨:
- lib/ Mongo/bulk_write.rb,
lib/ Mongo/bulk_write/result.rb,
lib/ Mongo/bulk_write/combineable.rb,
lib/ Mongo/bulk_write/validatable.rb,
lib/ Mongo/bulk_write/transformable.rb,
lib/ Mongo/bulk_write/result_combiner.rb,
lib/ Mongo/bulk_write/ordered_combiner.rb,
lib/ Mongo/bulk_write/unordered_combiner.rb
네임스페이스 아래에 정의됨
모듈: 결합 가능, 변환 가능,유효성 검사 가능 클래스: OrderedCombiner, Result, ResultCombiner, UnorderedCombiner
인스턴스 속성 요약 접기
-
#컬렉션 ⇒ Mongo::Collection
읽기 전용
컬렉션 컬렉션 입니다.
-
#options ⇒ Hash, BSON::Document
읽기 전용
옵션 옵션입니다.
-
#requests ⇒ Array<Hash, BSON::Document>
읽기 전용
요청 요청입니다.
인스턴스 메서드 요약 접기
-
#실행 ⇒ Mongo::BulkWrite::Result
대량 쓰기 (write) 작업을 실행합니다.
-
#initialize(collection, requests, options = {}) ⇒ BulkWrite
생성자
비공개
새 대량 쓰기 (write) 작업을 만듭니다.
-
#주문했습니까? ⇒ 참, 거짓
비공개
대량 쓰기 (write) 가 정렬되나요?
-
#write_concern(session = nil) ⇒ WriteConcern
비공개
대량 쓰기 (write) 에 대한 쓰기 고려 (write concern) 를 가져옵니다.
생성자 세부 정보
#initialize(collection, requests, options = {}) ⇒ BulkWrite
이 메서드는 비공개 API의 일부입니다. 이 방법은 향후 제거되거나 변경될 수 있으므로 가능하면 사용하지 않는 것이 좋습니다.
새 대량 쓰기 (write) 작업을 만듭니다.
128 129 130 131 132 133 134 135 |
# 파일 'lib/ Mongo/bulk_write.rb', 128줄 def 초기화(컬렉션, 요청, = {}) @collection = 컬렉션 @requests = 요청 @options = || {} 만약 @options[:timeout_ms] && @options[:timeout_ms] < 0 올리다 ArgumentError, "timeout_ms 옵션은 음수가 아닌 정수여야 합니다" end end |
인스턴스 속성 세부 정보
#컬렉션 ⇒ Mongo::Collection (읽기 전용)
반환값 컬렉션 컬렉션.
32 33 34 |
# 파일 'lib/ Mongo/bulk_write.rb', 32줄 def 컬렉션 @collection end |
#options ⇒ 해시, BSON::Document (읽기 전용)
반환값 options options.
38 39 40 |
# 파일 'lib/ Mongo/bulk_write.rb', 38줄 def @options end |
#requests ⇒ Array<Hash, BSON::Document> (읽기 전용)
요청을 반환합니다.
35 36 37 |
# 파일 'lib/ Mongo/bulk_write.rb', 35줄 def 요청 @requests end |
인스턴스 메서드 세부 정보
#실행 ⇒ Mongo::BulkWrite::Result
대량 쓰기 (write) 작업을 실행합니다.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# 파일 'lib/ Mongo/bulk_write.rb', 58줄 def 실행 operation_id = 모니터링.Next_operation_id result_combiner = ResultCombiner.신규 연산 = op_combiner.결합 validate_requests! 마감일 = compute_deadline 고객.with_session(@options) do |Session| 연산.각 do |작업| 컨텍스트 = 작업::Context.신규( 클라이언트: 고객, 세션: Session, operation_timeout: { operation_timeout_ms: op_timeout_ms(마감일) } ) 만약 single_statement?(작업) write_concern = write_concern(Session) write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, txn_num, 컨텍스트| execution_operation( 작업.키.first, 작업.values.flatten, 연결, 컨텍스트, operation_id, result_combiner, Session, txn_num) end other nro_write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, txn_num, 컨텍스트| execution_operation( 작업.키.first, 작업.values.flatten, 연결, 컨텍스트, operation_id, result_combiner, Session) end end end end result_combiner.결과 end |
#주문했습니까? ⇒ true, false
이 메서드는 비공개 API의 일부입니다. 이 방법은 향후 제거되거나 변경될 수 있으므로 가능하면 사용하지 않는 것이 좋습니다.
대량 쓰기 (write) 는 순서가 지정되나요?
147 148 149 |
# 파일 'lib/ Mongo/bulk_write.rb', 147줄 def 주문? @ordered ||= .가져오기(:ordered, true) end |
#write_concern(session = nil) ⇒ WriteConcern
이 메서드는 비공개 API의 일부입니다. 이 방법은 향후 제거되거나 변경될 수 있으므로 가능하면 사용하지 않는 것이 좋습니다.
대량 쓰기 (write) 에 대한 쓰기 고려 (write concern) 를 가져옵니다.
161 162 163 164 165 |
# 파일 'lib/ Mongo/bulk_write.rb', 161줄 def write_concern(Session = nil) @write_concern ||= [:write_concern] ? writeConcern.get([:write_concern]) : 컬렉션.write_concern_with_session(Session) end |