模块: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



73
74
75
76
77
78
79
80
81
# File 'lib/ Mongo/operation/shared/ 写入.rb', line 73

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

  if 连接.功能.op_msg_enabled?
    self.class::OpMsg.new(spec).执行(连接, 上下文: 上下文).bulk_result
  else
    self.class::命令.new(spec).执行(连接, 上下文: 上下文).bulk_result
  end
end

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

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

执行操作。

参数:

返回:

由于:

  • 2.5.2



37
38
39
40
41
42
43
44
# File 'lib/ Mongo/operation/shared/ 写入.rb', line 37

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



54
55
56
57
58
59
60
# File 'lib/ Mongo/operation/shared/ 写入.rb', line 54

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

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