模块:Mongo::Operation::Write Private

包括:
ResponseHandling
包含在:
删除插入更新
定义于:
lib/ Mongo/operation/shared/ 写入.rb

Overview

该模块是私有 API 的一部分。 您应尽可能避免使用此模块,因为它将来可能会被删除或更改。

写入操作(更新、插入、删除)的共享行为。

由于:

  • 2.5.2

实例方法摘要折叠

实例方法详细信息

# bulk_execute (connection, context:) ⇒ Mongo::Operation::Delete::BulkResult , ...

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

执行批量写入操作。

参数:

返回:

由于:

  • 2.5.2



70
71
72
73
74
# File 'lib/ Mongo/operation/shared/ 写入.rb', line 70

def bulk_execute(连接, 上下文:)
  Lint.assert_type(连接, 服务器::连接)

  self.class::OpMsg.new(spec).执行(连接, 上下文: 上下文).bulk_result
end

#execute (server, context:) ⇒ Mongo::Operation::Result

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

执行操作。

参数:

返回:

由于:

  • 2.5.2



34
35
36
37
38
39
40
41
# File 'lib/ Mongo/operation/shared/ 写入.rb', line 34

def 执行(server, 上下文:)
  server.with_connection(
    connection_global_id: 上下文.connection_global_id,
    上下文: 上下文
  ) do |连接|
    execute_with_connection(连接, 上下文: 上下文)
  end
end

#execute_with_connection (connection, context:) ⇒ Mongo::Operation::Result

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

执行操作。

参数:

返回:

由于:

  • 2.5.2



51
52
53
54
55
56
57
# File 'lib/ Mongo/operation/shared/ 写入.rb', line 51

def execute_with_connection(连接, 上下文:)
  validate!(连接)
  op = self.class::OpMsg.new(spec)

  结果 = op.执行(连接, 上下文: 上下文)
  validate_result(结果, 连接, 上下文)
end