类:Mongo::Operation::ListCollections::Result
- 继承:
-
操作::结果
- 对象
- 操作::结果
- Mongo::Operation::ListCollections::Result
- 定义于:
- lib/ Mongo/operation/list_collections/result.rb
Overview
定义使用 listCollections 命令时结果的自定义行为。
实例方法摘要折叠
-
# cursor_id = "Integer"
private
获取结果的游标ID。
-
# 个documents ⇒ Array<BSON::Document>
获取 listCollections 结果的文档。
-
#命名空间⇒ string
private
获取游标的命名空间。
-
#validate! ⇒ Result
private
验证结果。
实例方法详细信息
# cursor_id = " Integer "
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
注意:
尽管传输协议具有适用于所有回复类型消息的 cursor_id 字段,但在使用 listCollections 命令时该字段始终为零,并且必须从游标文档本身中检索。
获取结果的游标ID。
40 41 42 |
# File 'lib/ Mongo/operation/list_collections/result.rb', line 40 def cursor_id cursor_document ? cursor_document[CURSOR_ID] : 超 end |
# 个documents ⇒ Array<BSON::Document>
获取 listCollections 结果的文档。它是返回的第一个文档的“ 游标”字段中的“ firstBatch ”字段。
67 68 69 |
# File 'lib/ Mongo/operation/list_collections/result.rb', line 67 def 文档 cursor_document[FIRST_BATCH] end |
#命名空间⇒ string
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取游标的命名空间。
53 54 55 |
# File 'lib/ Mongo/operation/list_collections/result.rb', line 53 def namespace cursor_document ? cursor_document[名称空间] : 超 end |
# validate! ⇒结果
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
验证结果。 如果未经授权的客户端尝试运行该命令,我们需要生成适当的错误。
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ Mongo/operation/list_collections/result.rb', line 81 def validate! if 成功? self else 提高 operation_failure_class.new( 解析器., self, 代码: 解析器.代码, code_name: 解析器.code_name, 标签: 解析器.labels, wtimeout: 解析器.wtimeout, 文档: 解析器.文档, server_message: 解析器. ) end end |