Method: Mongo::Error::Parser#initialize
- Defined in:
- lib/mongo/error/parser.rb
#initialize(document, replies = nil, options = nil) ⇒ Parser
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.
Create the new parser with the returned document.
In legacy mode, the code and codeName fields of the document are not examined because the status (ok: 1) is not part of the document and there is no way to distinguish successful from failed responses using the document itself, and a successful response may legitimately have { code: 123, codeName: ‘foo’ } as the contents of a user-inserted document. The legacy server versions do not fill out code nor codeName thus not reading them does not lose information.
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/mongo/error/parser.rb', line 122 def initialize(document, replies = nil, = nil) @document = document || {} @replies = replies @options = if .dup else {} end.freeze parse! end |