Class: Mongo::Operation::Find::OpMsg Private
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
self,
::Mongo::Operation::PolymorphicResult ,
::Mongo::Operation::PolymorphicLookup ,
::Mongo::Operation::ExecutableTransactionLabel ,
::Mongo::Operation::CausalConsistencySupported ,
::Mongo::Operation::OpMsgBase ,
::Mongo::Operation::Timed ,
::Mongo::Operation::SessionsSupported ,
::Mongo::Operation::Executable ,
::Mongo::Operation::ResponseHandling ,
::Mongo::Operation::Specifiable
|
|
Inherits: |
Mongo::Operation::OpMsgBase
|
Defined in: | lib/mongo/operation/find/op_msg.rb |
Overview
A MongoDB find operation sent as an op message.
Constant Summary
::Mongo::Operation::Specifiable
- Included
BYPASS_DOC_VALIDATION, COLLATION, COLL_NAME, CURSOR_COUNT, CURSOR_ID, DB_NAME, DELETE, DELETES, DOCUMENTS, INDEX, INDEXES, INDEX_NAME, MAX_TIME_MS, OPERATION_ID, OPTIONS, READ, READ_CONCERN, SELECTOR, TO_RETURN, UPDATE, UPDATES, USER, USER_NAME, WRITE_CONCERN
::Mongo::Operation::Executable
- Included
::Mongo::Operation::SessionsSupported
- Included
Instance Attribute Summary
::Mongo::Operation::Executable
- Included
::Mongo::Operation::Specifiable
- Included
#acknowledged_write? | Does the operation have an acknowledged write concern. |
#ordered? | Whether the operation is ordered. |
#spec |
Instance Method Summary
- #apply_find_timeouts_to(spec, timeout_ms) private Internal use only
-
#apply_relevant_timeouts_to(spec, connection)
private
Internal use only
Applies the relevant CSOT timeouts for a find command.
- #selector(connection) private Internal use only
::Mongo::Operation::PolymorphicResult
- Included
::Mongo::Operation::PolymorphicLookup
- Included
::Mongo::Operation::CausalConsistencySupported
- Included
#apply_causal_consistency! | Adds causal consistency document to the selector, if one can be constructed. |
::Mongo::Operation::OpMsgBase
- Inherited
::Mongo::Operation::Timed
- Included
#apply_relevant_timeouts_to | If a timeout is active (as defined by the current context), and it has not yet expired, add |
#with_max_time | A helper method that computes the remaining timeout (in seconds) and yields it to the associated block. |
::Mongo::Operation::SessionsSupported
- Included
#add_read_preference | Adds $readPreference field to the command document. |
#add_write_concern!, #apply_autocommit!, | |
#apply_causal_consistency! | Adds causal consistency document to the selector, if one can be constructed and the selector is for a startTransaction command. |
#apply_causal_consistency_if_possible | Adds causal consistency document to the selector, if one can be constructed. |
#apply_cluster_time!, #apply_read_pref!, #apply_session_options, #apply_start_transaction!, #apply_txn_num!, #apply_txn_opts!, #build_message, #command, #flags, #read_command?, #suppress_read_write_concern!, #validate_read_preference! |
::Mongo::Operation::Executable
- Included
#do_execute, #execute, #build_message, #check_for_network_error, | |
#dispatch_message | Returns a |
#get_result, #process_result, #process_result_for_sdam, #result_class |
::Mongo::Operation::ResponseHandling
- Included
#add_error_labels | Adds error labels to exceptions raised in the yielded to block, which should perform MongoDB operations and raise Mongo::Errors on failure. |
#add_server_diagnostics | Yields to the block and, if the block raises an exception, adds a note to the exception with the address of the specified server. |
#maybe_add_retryable_write_error_label! | A method that will add the RetryableWriteError label to an error if any of the following conditions are true: |
#unpin_maybe | Unpins the session and/or the connection if the yielded to block raises errors that are required to unpin the session and the connection. |
#validate_result |
::Mongo::Operation::Specifiable
- Included
#== | Check equality of two specifiable operations. |
#apply_collation, | |
#array_filters | The array filters. |
#bypass_document_validation | Whether or not to bypass document level validation. |
#coll_name | The name of the collection to which the operation should be sent. |
#collation | The collation to apply to the operation. |
#command | The command. |
#cursor_count | Get the cursor count from the spec. |
#cursor_id | The id of the cursor created on the server. |
#db_name | The name of the database to which the operation should be sent. |
#delete | Get the delete document from the specification. |
#deletes | Get the deletes from the specification. |
#documents | The documents to in the specification. |
#eql? | Alias for Specifiable#==. |
#index | Get the index from the specification. |
#index_id | Get the index id from the spec. |
#index_name | Get the index name from the spec. |
#indexes | Get the indexes from the specification. |
#initialize |
|
#max_time_ms | Get the max time ms value from the spec. |
#namespace | The namespace, consisting of the db name and collection name. |
#operation_id | Get the operation id for the operation. |
#options | Get the options for executing the operation on a particular connection. |
#read | The read preference for this operation. |
#read_concern | Get the read concern document from the spec. |
#selector | The selector from the specification for execution on a particular connection. |
#session | The session to use for the operation. |
#to_return | The number of documents to request from the server. |
#txn_num | The transaction number for the operation. |
#update | The update document from the spec. |
#updates | The update documents from the spec. |
#user | The user for user related operations. |
#user_name | The user name from the specification. |
#write_concern | The write concern to use for this operation. |
Instance Method Details
#apply_find_timeouts_to(spec, timeout_ms) (private)
# File 'lib/mongo/operation/find/op_msg.rb', line 44
def apply_find_timeouts_to(spec, timeout_ms) view = context&.view return spec unless view case view.cursor_type when nil # non-tailable if view.timeout_mode == :cursor_lifetime spec[:maxTimeMS] = timeout_ms || view. [:max_time_ms] else # timeout_mode == :iterable # drivers MUST honor the timeoutMS option for the initial command # but MUST NOT append a maxTimeMS field to the command sent to the # server if !timeout_ms && view. [:max_time_ms] spec[:maxTimeMS] = view. [:max_time_ms] end end when :tailable # If timeoutMS is set, drivers...MUST NOT append a maxTimeMS field to any commands. if !timeout_ms && view. [:max_time_ms] spec[:maxTimeMS] = view. [:max_time_ms] end when :tailable_await # The server supports the maxTimeMS option for the original command. if timeout_ms || view. [:max_time_ms] spec[:maxTimeMS] = timeout_ms || view. [:max_time_ms] end end spec.tap do |spc| spc.delete(:maxTimeMS) if spc[:maxTimeMS].nil? end end
#apply_relevant_timeouts_to(spec, connection) (private)
Applies the relevant CSOT timeouts for a find command. Considers the cursor type and timeout mode and will add (or omit) a maxTimeMS field accordingly.
# File 'lib/mongo/operation/find/op_msg.rb', line 37
def apply_relevant_timeouts_to(spec, connection) with_max_time(connection) do |max_time_sec| timeout_ms = max_time_sec ? (max_time_sec * 1_000).to_i : nil apply_find_timeouts_to(spec, timeout_ms) unless connection.description.mongocryptd? end end
#selector(connection) (private)
# File 'lib/mongo/operation/find/op_msg.rb', line 79
def selector(connection) # The mappings are BSON::Documents and as such store keys as # strings, the spec here has symbol keys. spec = BSON::Document.new(self.spec) { find: coll_name, Protocol::Msg::DATABASE_IDENTIFIER => db_name, }.update(Find::Builder::Command.selector(spec, connection)) end