Class: Mongo::Protocol::GetMore::Upconverter

继承:
对象
  • 对象
显示全部
定义于:
lib/ Mongo/ 协议/get_more.rb

Overview

将旧版 getMore 消息转换为相应的 OP_COMMAND 样式消息。

由于:

  • 2.1.0

常量摘要折叠

GET_MORE =
已弃用。

变得更加稳定。

由于:

  • 2.2.0

'getmore'

实例属性摘要折叠

实例方法摘要折叠

构造函数详情

#initialize (collection, cursor_id, number_to_return) ⇒上转换

实例化上转换器。

例子:

实例化上转换器。

Upconverter.new('users', 1, 1)

参数:

  • 集合 ( string )

    集合的名称。

  • cursor_id ( Integer )

    游标 ID。

  • number_to_return ( Integer )

    要返回的文档数量。

由于:

  • 2.1.0



133
134
135
136
137
# File 'lib/ Mongo/ 协议/get_more.rb', line 133

def 初始化(集合, cursor_id, number_to_return)
  @collection = 集合
  @cursor_id = cursor_id
  @number_to_return = number_to_return
end

实例属性详细信息

#集合string (只读)

返回 collection 集合的名称。

返回:

  • ( string )

    集合的名称。

由于:

  • 2.1.0



114
115
116
# File 'lib/ Mongo/ 协议/get_more.rb', line 114

def 集合
  @collection
end

# cursor_id整数(只读)

返回 cursor_id 游标 ID。

返回:

  • ( Integer )

    cursor_id 游标 ID。

由于:

  • 2.1.0



117
118
119
# File 'lib/ Mongo/ 协议/get_more.rb', line 117

def cursor_id
  @cursor_id
end

# number_to_return整数(只读)

返回 number_to_return 要返回的Docs数量。

返回:

  • ( Integer )

    number_to_return 要返回的Docs数量。

由于:

  • 2.1.0



120
121
122
# File 'lib/ Mongo/ 协议/get_more.rb', line 120

def number_to_return
  @number_to_return
end

实例方法详细信息

#commandBSON::Document

获取上转换命令。

例子:

获取命令。

upconverter.command

返回:

  • ( BSON::Document )

    上转换命令。

由于:

  • 2.1.0



147
148
149
150
151
152
153
# File 'lib/ Mongo/ 协议/get_more.rb', line 147

def 命令
  文档 = BSON::文档.new
  文档.存储(' getMore ', BSON::Int64.new(cursor_id))
  文档.存储(message::BATCH_SIZE, number_to_return)
  文档.存储(message::Collection, 集合)
  文档
end