Method: Mongo::Operation::ListCollections::Result#validate!

Defined in:
lib/mongo/operation/list_collections/result.rb

#validate!Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Validate the result. In the case where an unauthorized client tries to run the command we need to generate the proper error.

Examples:

Validate the result.

result.validate!

Returns:

  • (Result)

    Self if successful.

Since:

  • 2.0.0



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/mongo/operation/list_collections/result.rb', line 84

def validate!
  if successful?
    self
  else
    raise Error::OperationFailure.new(
      parser.message,
      self,
      code: parser.code,
      code_name: parser.code_name,
      labels: parser.labels,
      wtimeout: parser.wtimeout,
      document: parser.document,
      server_message: parser.server_message,
    )
  end
end