모듈: Mongo::Collection::View::Writable

포함 항목:
Mongo::Collection::View
다음에 정의됨:
lib/ Mongo/ 컬렉션/view/writable.rb

개요

컬렉션 보기에 대한 쓰기 (write) 관련 동작을 정의합니다.

이후:

  • 2.0.0

상수 요약 접기

ARRAY_FILTERS =

배열은 필드 상수를 필터링합니다.

이후:

  • 2.5.0

'array_filters'

인스턴스 메서드 요약 접기

인스턴스 메서드 세부 정보

#delete_many(opts = {}) ⇒ 결과

컬렉션 에서 문서를 제거합니다.

예시:

컬렉션에서 여러 문서를 제거합니다.

collection_view.delete_many

매개변수:

  • opts (해시) (기본값: {}) —

    옵션.

  • 옵션 (해시) —

    사용자 지정 가능한 옵션 세트

옵션 해시(opts):

  • :collation (해시) —

    사용할 데이터 정렬입니다.

  • :session (세션) —

    사용할 세션입니다.

  • :hint (해시 | string) —

    이 작업에 사용할 인덱스 . 해시(예: { _id: 1 }) 또는 string(예: "ID").

  • :write_concern (해시) —

    쓰기 고려 (write concern) 옵션. :w => 정수, : fsync => 부울, :j => 부울일 수 있습니다.

  • :let (해시) —

    명령에 사용할 변수를 매핑합니다. 자세한 내용은 서버 설명서를 참조하세요.

  • :comment (객체) —

    이 명령에 첨부할 사용자 제공 코멘트입니다.

반환합니다:

  • (결과) —

    데이터베이스 의 응답입니다.

이후:

  • 2.0.0



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# 파일 'lib/ Mongo/ 컬렉션/view/writable.rb', 줄 247

def delete_many(opts = {})
  with_session(opts) do |Session|
    write_concern = 만약 opts[:write_concern]
                      writeConcern.get(opts[:write_concern])
                    other
                      write_concern_with_session(Session)
                    end

    쿼리 캐시.clear_namespace(컬렉션.namespace)

    delete_doc = {
      작업::q => 필터,
      작업::LIMIT => 0,
      hint: opts[:hint],
      데이터 정렬: opts[:collation] || opts['데이터 정렬'] || 데이터 정렬,
    }.컴팩트
    컨텍스트 = 작업::Context.신규(
      클라이언트: 고객,
      세션: Session,
      operation_timeout: operation_timeout(opts)
    )
    작업 = 작업::삭제.신규(
      삭제합니다: [ delete_doc ],
      db_name: 컬렉션.database.이름,
      coll_name: 컬렉션.이름,
      write_concern: write_concern,
      bypass_document_validation: !!opts[:bypass_document_validation],
      세션: Session,
      let: opts[:let],
      comment: opts[:comment]
    )
    추적 프로그램.trace_operation(작업, 컨텍스트, op_name: 'deleteMany') do
      nro_write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, _txn_num, 컨텍스트|
        작업.execution_with_connection(연결, 컨텍스트: 컨텍스트)
      end
    end
  end
end

#delete_one(opts = {}) ⇒ 결과

컬렉션 에서 문서 를 제거합니다.

예시:

컬렉션 에서 단일 문서 를 제거합니다.

collection_view.delete_one

매개변수:

  • opts (해시) (기본값: {}) —

    옵션.

  • 옵션 (해시) —

    사용자 지정 가능한 옵션 세트

옵션 해시(opts):

  • :collation (해시) —

    사용할 데이터 정렬입니다.

  • :comment (객체) —

    이 명령에 첨부할 사용자 제공 코멘트입니다.

  • :hint (해시 | string) —

    이 작업에 사용할 인덱스 . 해시(예: { _id: 1 }) 또는 string(예: "ID").

  • :let (해시) —

    명령에 사용할 변수를 매핑합니다. 자세한 내용은 서버 설명서를 참조하세요.

  • :session (세션) —

    사용할 세션입니다.

  • :write_concern (해시) —

    쓰기 고려 (write concern) 옵션. :w => 정수, : fsync => 부울, :j => 부울일 수 있습니다.

반환합니다:

  • (결과) —

    데이터베이스 의 응답입니다.

이후:

  • 2.0.0



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# 파일 'lib/ Mongo/ 컬렉션/view/writable.rb', 줄 311

def delete_one(opts = {})
  with_session(opts) do |Session|
    write_concern = 만약 opts[:write_concern]
                      writeConcern.get(opts[:write_concern])
                    other
                      write_concern_with_session(Session)
                    end

    쿼리 캐시.clear_namespace(컬렉션.namespace)

    delete_doc = {
      작업::q => 필터,
      작업::LIMIT => 1,
      hint: opts[:hint],
      데이터 정렬: opts[:collation] || opts['데이터 정렬'] || 데이터 정렬,
    }.컴팩트

    컨텍스트 = 작업::Context.신규(
      클라이언트: 고객,
      세션: Session,
      operation_timeout: operation_timeout(opts)
    )
    write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, txn_num, 컨텍스트|
      작업::삭제.신규(
        삭제합니다: [ delete_doc ],
        db_name: 컬렉션.database.이름,
        coll_name: 컬렉션.이름,
        write_concern: write_concern,
        bypass_document_validation: !!opts[:bypass_document_validation],
        세션: Session,
        txn_num: txn_num,
        let: opts[:let],
        comment: opts[:comment]
      ).execution_with_connection(연결, 컨텍스트: 컨텍스트)
    end
  end
end

#find_one_and_delete(opts = {}) ⇒ BSON::Document?

findAndModify를 통해 데이터베이스에서 단일 문서를 찾아 삭제하고 원본 문서를 반환합니다.

예시:

하나의 문서 를 찾아 삭제 합니다.

view.find_one_and_delete

매개변수:

  • opts (해시) (기본값: {}) —

    옵션.

  • 옵션 (해시) —

    사용자 지정 가능한 옵션 세트

옵션 해시(opts):

  • :max_time_ms (정수) —

    명령이 실행 수 있는 최대 시간(밀리초)입니다. 이 옵션은 더 이상 사용되지 않으므로 대신 :timeout_ms를 사용하세요.

  • :projection (해시) —

    반환된 문서에 포함하거나 제외할 필드입니다.

  • :sort (해시) —

    결과 설정하다 의 정렬 기준이 되는 키 및 방향 쌍입니다.

  • :collation (해시) —

    사용할 데이터 정렬입니다.

  • :session (세션) —

    사용할 세션입니다.

  • :hint (해시 | string) —

    이 작업에 사용할 인덱스 . 해시(예: { _id: 1 }) 또는 string(예: "ID").

  • :write_concern (해시) —

    쓰기 고려 (write concern) 옵션. :w => 정수, : fsync => 부울, :j => 부울일 수 있습니다.

  • :let (해시) —

    명령에 사용할 변수를 매핑합니다. 자세한 내용은 서버 설명서를 참조하세요.

  • :comment (객체) —

    이 명령에 첨부할 사용자 제공 코멘트입니다.

반환합니다:

  • (BSON::Document, nil) —

    문서(있는 경우).

이후:

  • 2.0.0



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/ 컬렉션/view/writable.rb', 줄 61

def find_one_and_delete(opts = {})
  with_session(opts) do |Session|
    write_concern = 만약 opts[:write_concern]
                      writeConcern.get(opts[:write_concern])
                    other
                      write_concern_with_session(Session)
                    end

    쿼리 캐시.clear_namespace(컬렉션.namespace)

    cmd = {
      findAndModify: 컬렉션.이름,
      query: 필터,
      제거: true,
      필드: 프로젝션,
      sort: sort,
      maxTimeMS: max_time_ms,
      bypassDocumentValidation: opts[:bypass_document_validation],
      hint: opts[:hint],
      데이터 정렬: opts[:collation] || opts['데이터 정렬'] || 데이터 정렬,
      let: opts[:let],
      comment: opts[:comment],
    }.컴팩트

    컨텍스트 = 작업::Context.신규(
      클라이언트: 고객,
      세션: Session,
      operation_timeout: operation_timeout(opts)
    )
    write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, txn_num, 컨텍스트|
      작업::WriteCommand.신규(
        선택기: cmd,
        db_name: database.이름,
        write_concern: write_concern,
        세션: Session,
        txn_num: txn_num
      ).execution_with_connection(연결, 컨텍스트: 컨텍스트)
    end
  end.first&.가져오기('value', nil)
end

#find_one_and_replace(replacement, opts = {}) ⇒ BSON::Document

하나의 문서를 찾아서 대체합니다.

예시:

문서 를 찾아 교체하고 원본을 반환합니다.

view.find_one_and_replace({ name: 'test' }, :return_document => :before)

문서 를 찾아 교체하고 새 문서 를 반환합니다.

view.find_one_and_replace({ name: 'test' }, :return_document => :after)

매개변수:

  • 교체 (BSON::Document) —

    교체.

  • opts (해시) (기본값: {}) —

    옵션.

  • 옵션 (해시) —

    사용자 지정 가능한 옵션 세트

옵션 해시(opts):

  • :return_document (기호) —

    :before 또는 :after.

  • : 업서트 (true, false) —

    문서 존재하지 않는 경우 업서트 할지 여부입니다.

  • :bypass_document_validation (true, false) —

    문서 수준 유효성 검사 를 건너뛸지 여부입니다.

  • :collation (해시) —

    사용할 데이터 정렬입니다.

  • :hint (해시 | string) —

    이 작업에 사용할 인덱스 . 해시(예: { _id: 1 }) 또는 string(예: "ID").

  • :write_concern (해시) —

    쓰기 고려 (write concern) 옵션. :w => 정수, : fsync => 부울, :j => 부울일 수 있습니다.

  • :let (해시) —

    명령에 사용할 변수를 매핑합니다. 자세한 내용은 서버 설명서를 참조하세요.

반환합니다:

  • (BSON::Document) —

    문서입니다.

이후:

  • 2.0.0



132
133
134
# 파일 'lib/ Mongo/ 컬렉션/view/writable.rb', 줄 132

def find_one_and_replace(교체, opts = {})
  find_one_and_update(교체, opts)
end

#find_one_and_update(document, opts = {}) ⇒ BSON::Document | nil

단일 문서를 찾아서 업데이트합니다.

업데이트 가 적용 되어야 합니다.

예시:

문서 를 찾아 업데이트 하고 원본을 반환합니다.

view.find_one_and_update({ "$set" => { name: 'test' }}, :return_document => :before)

매개변수:

  • 문서 (BSON::Document) —

    업데이트.

  • opts (해시) (기본값: {}) —

    옵션.

  • 옵션 (해시) —

    사용자 지정 가능한 옵션 세트

옵션 해시(opts):

  • :max_time_ms (정수) —

    명령이 실행 수 있는 최대 시간(밀리초)입니다. 이 옵션은 더 이상 사용되지 않으므로 대신 :timeout_ms를 사용하세요.

  • :projection (해시) —

    반환된 문서에 포함하거나 제외할 필드입니다.

  • :sort (해시) —

    결과 설정하다 의 정렬 기준이 되는 키 및 방향 쌍입니다.

  • :return_document (기호) —

    :before 또는 :after.

  • : 업서트 (true, false) —

    문서 존재하지 않는 경우 업서트 할지 여부입니다.

  • :bypass_document_validation (true, false) —

    문서 수준 유효성 검사 를 건너뛸지 여부입니다.

  • :collation (해시) —

    사용할 데이터 정렬입니다.

  • :array_filters (배열) —

    배열 요소를 지정하는 필터 설정하다 입니다.

  • :session (세션) —

    사용할 세션입니다.

  • :hint (해시 | string) —

    이 작업에 사용할 인덱스 . 해시(예: { _id: 1 }) 또는 string(예: "ID").

  • :write_concern (해시) —

    쓰기 고려 (write concern) 옵션. :w => 정수, : fsync => 부울, :j => 부울일 수 있습니다.

  • :let (해시) —

    명령에 사용할 변수를 매핑합니다. 자세한 내용은 서버 설명서를 참조하세요.

  • :comment (객체) —

    이 명령에 첨부할 사용자 제공 코멘트입니다.

반환합니다:

  • (BSON::Document | nil) —

    문서를 반환하거나, 문서를 찾을 수 없는 경우 nil을 반환합니다.

이후:

  • 2.0.0



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# 파일 'lib/ Mongo/ 컬렉션/view/writable.rb', 줄 174

def find_one_and_update(문서, opts = {})
  value = with_session(opts) do |Session|
    write_concern = 만약 opts[:write_concern]
                      writeConcern.get(opts[:write_concern])
                    other
                      write_concern_with_session(Session)
                    end

    쿼리 캐시.clear_namespace(컬렉션.namespace)

    cmd = {
      findAndModify: 컬렉션.이름,
      query: 필터,
      arrayFilters: opts[:array_filters] || opts['array_filters'],
      update: 문서,
      필드: 프로젝션,
      sort: sort,
      new: !!(opts[:return_document] && opts[:return_document] == :after),
      upsert: opts[: 업서트],
      maxTimeMS: max_time_ms,
      bypassDocumentValidation: opts[:bypass_document_validation],
      hint: opts[:hint],
      데이터 정렬: opts[:collation] || opts['데이터 정렬'] || 데이터 정렬,
      let: opts[:let],
      comment: opts[:comment]
    }.컴팩트

    컨텍스트 = 작업::Context.신규(
      클라이언트: 고객,
      세션: Session,
      operation_timeout: operation_timeout(opts)
    )
    작업 = 작업::WriteCommand.신규(
      선택기: cmd,
      db_name: database.이름,
      write_concern: write_concern,
      세션: Session
    )
    value = 추적 프로그램.trace_operation(작업, 컨텍스트, op_name: 'findOneAndUpdate') do
      write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, txn_num, 컨텍스트|
        작업.txn_num = txn_num
        작업.execution_with_connection(연결, 컨텍스트: 컨텍스트)
      end
    end.first&.가져오기('value', nil)
    value 하지 않는 한 value.nil? || value.비어 있나요?
  end
end

#replace_one(replacement, opts = {}) ⇒ 결과

데이터베이스 의 단일 문서 를 새 문서 로 바꿉니다.

예시:

단일 문서 를 교체합니다.

collection_view.replace_one({ name: 'test' })

매개변수:

  • 교체 (해시) —

    대체 문서입니다.

  • opts (해시) (기본값: {}) —

    옵션.

  • 옵션 (해시) —

    사용자 지정 가능한 옵션 세트

옵션 해시(opts):

  • :bypass_document_validation (true, false) —

    문서 수준 유효성 검사 를 건너뛸지 여부입니다.

  • :collation (해시) —

    사용할 데이터 정렬입니다.

  • :comment (객체) —

    이 명령에 첨부할 사용자 제공 코멘트입니다.

  • :hint (해시 | string) —

    이 작업에 사용할 인덱스 . 해시(예: { _id: 1 }) 또는 string(예: "ID").

  • :let (해시) —

    명령에 사용할 변수를 매핑합니다. 자세한 내용은 서버 설명서를 참조하세요.

  • :session (세션) —

    사용할 세션입니다.

  • :write_concern (해시) —

    쓰기 고려 (write concern) 옵션.

  • : 업서트 (true, false) —

    문서 존재하지 않는 경우 업서트 할지 여부입니다. :w => 정수, : fsync => 불리언, :j => 불리언일 수 있습니다.

  • :sort (해시) —

    쿼리 여러 문서와 일치하는 경우 작업이 대체할 문서 지정합니다. 정렬 순서와 일치하는 첫 번째 문서 대체됩니다. 이 옵션은 >= 8.0인 서버에서만 지원됩니다. 이전 서버에서는 이 옵션을 사용하면 오류가 보고됩니다.

반환합니다:

  • (결과) —

    데이터베이스 의 응답입니다.

이후:

  • 2.0.0



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# 파일 'lib/ Mongo/ 컬렉션/view/writable.rb', 줄 384

def replace_one(교체, opts = {})
  with_session(opts) do |Session|
    write_concern = 만약 opts[:write_concern]
                      writeConcern.get(opts[:write_concern])
                    other
                      write_concern_with_session(Session)
                    end
    validate_replacement_documents!(교체)

    쿼리 캐시.clear_namespace(컬렉션.namespace)

    update_doc = {
      작업::q => 필터,
      arrayFilters: opts[:array_filters] || opts['array_filters'],
      작업::u => 교체,
      hint: opts[:hint],
      데이터 정렬: opts[:collation] || opts['데이터 정렬'] || 데이터 정렬,
      sort: opts[:sort] || opts['sort'],
    }.컴팩트
    update_doc['upsert'] = true 만약 opts[: 업서트]

    컨텍스트 = 작업::Context.신규(
      클라이언트: 고객,
      세션: Session,
      operation_timeout: operation_timeout(opts)
    )
    write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, txn_num, 컨텍스트|
      작업::Update.신규(
        updates: [ update_doc ],
        db_name: 컬렉션.database.이름,
        coll_name: 컬렉션.이름,
        write_concern: write_concern,
        bypass_document_validation: !!opts[:bypass_document_validation],
        세션: Session,
        txn_num: txn_num,
        let: opts[:let],
        comment: opts[:comment]
      ).execution_with_connection(연결, 컨텍스트: 컨텍스트)
    end
  end
end

#update_many(spec, opts = {}) ⇒ 결과

컬렉션 의 문서를 업데이트합니다.

예시:

컬렉션 에서 여러 문서를 업데이트합니다.

collection_view.update_many('$set' => { name: 'test' })

매개변수:

  • 사양 (해시 | Array<Hash>) —

    업데이트 문서 또는 파이프라인.

  • opts (해시) (기본값: {}) —

    옵션.

  • 옵션 (해시) —

    사용자 지정 가능한 옵션 세트

옵션 해시(opts):

  • :array_filters (배열) —

    업데이트 를 적용 해야 하는 배열 요소를 지정하는 필터 설정하다 입니다.

  • :bypass_document_validation (true, false) —

    문서 수준 유효성 검사 를 건너뛸지 여부입니다.

  • :collation (해시) —

    사용할 데이터 정렬입니다.

  • :comment (객체) —

    이 명령에 첨부할 사용자 제공 코멘트입니다.

  • :hint (해시 | string) —

    이 작업에 사용할 인덱스 . 해시(예: { _id: 1 }) 또는 string(예: "ID").

  • :let (해시) —

    명령에 사용할 변수를 매핑합니다. 자세한 내용은 서버 설명서를 참조하세요.

  • :session (세션) —

    사용할 세션입니다.

  • : 업서트 (true, false) —

    문서 존재하지 않는 경우 업서트 할지 여부입니다.

  • :write_concern (해시) —

    쓰기 고려 (write concern) 옵션. :w => 정수, : fsync => 부울, :j => 부울일 수 있습니다.

반환합니다:

  • (결과) —

    데이터베이스 의 응답입니다.

이후:

  • 2.0.0



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# 파일 'lib/ Mongo/ 컬렉션/view/writable.rb', 줄 458

def update_many(사양, opts = {})
  with_session(opts) do |Session|
    write_concern = 만약 opts[:write_concern]
                      writeConcern.get(opts[:write_concern])
                    other
                      write_concern_with_session(Session)
                    end
    validate_update_documents!(사양)

    쿼리 캐시.clear_namespace(컬렉션.namespace)

    update_doc = {
      작업::q => 필터,
      arrayFilters: opts[:array_filters] || opts['array_filters'],
      작업::u => 사양,
      작업::멀티 => true,
      hint: opts[:hint],
      데이터 정렬: opts[:collation] || opts['데이터 정렬'] || 데이터 정렬,
    }.컴팩트
    update_doc['upsert'] = true 만약 opts[: 업서트]

    컨텍스트 = 작업::Context.신규(
      클라이언트: 고객,
      세션: Session,
      operation_timeout: operation_timeout(opts)
    )
    nro_write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, _txn_num, 컨텍스트|
      작업::Update.신규(
        updates: [ update_doc ],
        db_name: 컬렉션.database.이름,
        coll_name: 컬렉션.이름,
        write_concern: write_concern,
        bypass_document_validation: !!opts[:bypass_document_validation],
        세션: Session,
        let: opts[:let],
        comment: opts[:comment]
      ).execution_with_connection(연결, 컨텍스트: 컨텍스트)
    end
  end
end

#update_one(spec, opts = {}) ⇒ 결과

컬렉션 에서 단일 문서 를 업데이트합니다.

예시:

컬렉션 에서 단일 문서 를 업데이트합니다.

collection_view.update_one('$set' => { name: 'test' })

매개변수:

  • 사양 (해시 | Array<Hash>) —

    업데이트 문서 또는 파이프라인.

  • opts (해시) (기본값: {}) —

    옵션.

  • 옵션 (해시) —

    사용자 지정 가능한 옵션 세트

옵션 해시(opts):

  • :array_filters (배열) —

    업데이트 를 적용 해야 하는 배열 요소를 지정하는 필터 설정하다 입니다.

  • :bypass_document_validation (true, false) —

    문서 수준 유효성 검사 를 건너뛸지 여부입니다.

  • :collation (해시) —

    사용할 데이터 정렬입니다.

  • :comment (객체) —

    이 명령에 첨부할 사용자 제공 코멘트입니다.

  • :hint (해시 | string) —

    이 작업에 사용할 인덱스 . 해시(예: { _id: 1 }) 또는 string(예: "ID").

  • :let (해시) —

    명령에 사용할 변수를 매핑합니다. 자세한 내용은 서버 설명서를 참조하세요.

  • :session (세션) —

    사용할 세션입니다.

  • : 업서트 (true, false) —

    문서 존재하지 않는 경우 업서트 할지 여부입니다.

  • :write_concern (해시) —

    쓰기 고려 (write concern) 옵션. :w => 정수, : fsync => 부울, :j => 부울일 수 있습니다.

  • :sort (해시) —

    쿼리 여러 문서와 일치하는 경우 작업을 업데이트할 문서 지정합니다. 정렬 순서와 일치하는 첫 번째 문서 업데이트됩니다. 이 옵션은 >= 8.0인 서버에서만 지원됩니다. 이전 서버에서는 이 옵션을 사용하면 오류가 보고됩니다.

반환합니다:

  • (결과) —

    데이터베이스 의 응답입니다.

이후:

  • 2.0.0



536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# 파일 'lib/ Mongo/ 컬렉션/view/writable.rb', 줄 536

def update_one(사양, opts = {})
  with_session(opts) do |Session|
    write_concern = 만약 opts[:write_concern]
                      writeConcern.get(opts[:write_concern])
                    other
                      write_concern_with_session(Session)
                    end
    validate_update_documents!(사양)

    쿼리 캐시.clear_namespace(컬렉션.namespace)

    update_doc = {
      작업::q => 필터,
      arrayFilters: opts[:array_filters] || opts['array_filters'],
      작업::u => 사양,
      hint: opts[:hint],
      데이터 정렬: opts[:collation] || opts['데이터 정렬'] || 데이터 정렬,
      sort: opts[:sort] || opts['sort'],
    }.컴팩트
    update_doc['upsert'] = true 만약 opts[: 업서트]

    컨텍스트 = 작업::Context.신규(
      클라이언트: 고객,
      세션: Session,
      operation_timeout: operation_timeout(opts)
    )
    작업 = 작업::Update.신규(
      updates: [ update_doc ],
      db_name: 컬렉션.database.이름,
      coll_name: 컬렉션.이름,
      write_concern: write_concern,
      bypass_document_validation: !!opts[:bypass_document_validation],
      세션: Session,
      let: opts[:let],
      comment: opts[:comment]
    )
    추적 프로그램.trace_operation(작업, 컨텍스트) do
      write_with_retry(write_concern, 컨텍스트: 컨텍스트) do |연결, txn_num, 컨텍스트|
        작업.txn_num = txn_num
        작업.execution_with_connection(연결, 컨텍스트: 컨텍스트)
      end
    end
  end
end