Module: Mongo::Operation::Specifiable Private
Overview
This module contains common functionality for convenience methods getting various values from the spec.
Constant Summary
-
BYPASS_DOC_VALIDATION =
# File 'lib/mongo/operation/shared/specifiable.rb', line 133
Whether to bypass document level validation.
:bypass_document_validation
-
COLLATION =
# File 'lib/mongo/operation/shared/specifiable.rb', line 138
A collation to apply to the operation.
:collation
-
COLL_NAME =
# File 'lib/mongo/operation/shared/specifiable.rb', line 48
The field for collection name.
:coll_name
-
CURSOR_COUNT =
# File 'lib/mongo/operation/shared/specifiable.rb', line 53
The field for cursor count.
:cursor_count
-
CURSOR_ID =
# File 'lib/mongo/operation/shared/specifiable.rb', line 58
The field for cursor id.
:cursor_id
-
DB_NAME =
# File 'lib/mongo/operation/shared/specifiable.rb', line 28
The field for database name.
:db_name
-
DELETE =
# File 'lib/mongo/operation/shared/specifiable.rb', line 38
The field for delete.
:delete
-
DELETES =
# File 'lib/mongo/operation/shared/specifiable.rb', line 33
The field for deletes.
:deletes
-
DOCUMENTS =
# File 'lib/mongo/operation/shared/specifiable.rb', line 43
The field for documents.
:documents
-
INDEX =
# File 'lib/mongo/operation/shared/specifiable.rb', line 63
The field for an index.
:index
-
INDEXES =
# File 'lib/mongo/operation/shared/specifiable.rb', line 68
The field for multiple indexes.
:indexes
-
INDEX_NAME =
# File 'lib/mongo/operation/shared/specifiable.rb', line 73
The field for index names.
:index_name
-
MAX_TIME_MS =
# File 'lib/mongo/operation/shared/specifiable.rb', line 93
The max time ms option.
:max_time_ms
-
OPERATION_ID =
# File 'lib/mongo/operation/shared/specifiable.rb', line 78
The operation id constant.
:operation_id
-
OPTIONS =
# File 'lib/mongo/operation/shared/specifiable.rb', line 83
The field for options.
:
-
READ =
# File 'lib/mongo/operation/shared/specifiable.rb', line 128
The field name for the read preference.
:read
-
READ_CONCERN =
# File 'lib/mongo/operation/shared/specifiable.rb', line 88
The read concern option.
:read_concern
-
SELECTOR =
# File 'lib/mongo/operation/shared/specifiable.rb', line 98
The field for a selector.
:selector
-
UPDATE =
# File 'lib/mongo/operation/shared/specifiable.rb', line 108
The field for update.
:update
-
UPDATES =
# File 'lib/mongo/operation/shared/specifiable.rb', line 103
The field for updates.
:updates
-
USER =
# File 'lib/mongo/operation/shared/specifiable.rb', line 113
The field name for a user.
:user
-
USER_NAME =
# File 'lib/mongo/operation/shared/specifiable.rb', line 118
The field name for user name.
:user_name
-
WRITE_CONCERN =
# File 'lib/mongo/operation/shared/specifiable.rb', line 123
The field name for a write concern.
:write_concern
Instance Attribute Summary
-
#acknowledged_write? ⇒ Boolean
readonly
Internal use only
Does the operation have an acknowledged write concern.
-
#ordered? ⇒ true, false
readonly
Internal use only
Whether the operation is ordered.
- #spec ⇒ Hash readonly Internal use only
-
#txn_num ⇒ Integer
rw
Internal use only
The transaction number for the operation.
- #txn_num=(num) rw Internal use only
Instance Method Summary
-
#==(other) ⇒ true, false
(also: #eql?)
Internal use only
Check equality of two specifiable operations.
- #apply_collation(selector, _connection, collation) Internal use only
-
#array_filters(connection) ⇒ Hash | nil
Internal use only
The array filters.
-
#bypass_document_validation ⇒ true, false
Internal use only
Whether or not to bypass document level validation.
-
#coll_name ⇒ String
Internal use only
The name of the collection to which the operation should be sent.
-
#collation ⇒ Hash
Internal use only
The collation to apply to the operation.
-
#command(connection) ⇒ Hash
Internal use only
The command.
-
#cursor_count ⇒ Integer
Internal use only
Get the cursor count from the spec.
-
#cursor_id ⇒ Integer
Internal use only
The id of the cursor created on the server.
-
#db_name ⇒ String
Internal use only
The name of the database to which the operation should be sent.
-
#delete ⇒ Hash
Internal use only
Get the delete document from the specification.
-
#deletes ⇒ Array<BSON::Document>
Internal use only
Get the deletes from the specification.
-
#documents ⇒ Array<BSON::Document>
Internal use only
The documents to in the specification.
-
#eql?(other)
Alias for #==.
-
#index ⇒ Hash
Internal use only
Get the index from the specification.
-
#index_id ⇒ String
Internal use only
Get the index id from the spec.
-
#index_name ⇒ String
Internal use only
Get the index name from the spec.
-
#indexes ⇒ Hash
Internal use only
Get the indexes from the specification.
-
#initialize(spec)
Internal use only
Createthe new specifiable operation. -
#max_time_ms ⇒ Hash
Internal use only
Get the max time ms value from the spec.
-
#namespace ⇒ String
Internal use only
The namespace, consisting of the db name and collection name.
-
#operation_id ⇒ Integer
Internal use only
Get the operation id for the operation.
-
#options(_connection) ⇒ Hash
Internal use only
Get the options for executing the operation on a particular connection.
-
#read ⇒ Mongo::ServerSelector
Internal use only
The read preference for this operation.
-
#read_concern ⇒ Hash
Internal use only
Get the read concern document from the spec.
-
#selector(_connection) ⇒ Hash
Internal use only
The selector from the specification for execution on a particular connection.
-
#session ⇒ Session
Internal use only
The session to use for the operation.
-
#update ⇒ Hash
Internal use only
The update document from the spec.
-
#updates ⇒ Array<BSON::Document>
Internal use only
The update documents from the spec.
-
#user ⇒ Auth::User
Internal use only
The user for user related operations.
-
#user_name ⇒ String
Internal use only
The user name from the specification.
-
#write_concern ⇒ Mongo::WriteConcern
Internal use only
The write concern to use for this operation.
Instance Attribute Details
#acknowledged_write? ⇒ Boolean (readonly)
Does the operation have an acknowledged write concern.
# File 'lib/mongo/operation/shared/specifiable.rb', line 542
def acknowledged_write? write_concern.nil? || write_concern.acknowledged? end
#ordered? ⇒ true, false (readonly)
Whether the operation is ordered.
# File 'lib/mongo/operation/shared/specifiable.rb', line 468
def ordered? !!@spec.fetch(:ordered, true) end
#spec ⇒ Hash (readonly)
# File 'lib/mongo/operation/shared/specifiable.rb', line 141
attr_reader :spec
#txn_num ⇒ Integer (rw)
The transaction number for the operation.
# File 'lib/mongo/operation/shared/specifiable.rb', line 504
def txn_num @spec[:txn_num] end
#txn_num=(num) (rw)
# File 'lib/mongo/operation/shared/specifiable.rb', line 508
def txn_num=(num) @spec[:txn_num] = num end
Instance Method Details
#==(other) ⇒ true, false
Also known as: #eql?
Check equality of two specifiable operations.
#apply_collation(selector, _connection, collation)
#array_filters(connection) ⇒ Hash | nil
The array filters.
# File 'lib/mongo/operation/shared/specifiable.rb', line 529
def array_filters(connection) sel = selector(connection) sel[Operation::ARRAY_FILTERS] if sel end
#bypass_document_validation ⇒ true, false
Whether or not to bypass document level validation.
# File 'lib/mongo/operation/shared/specifiable.rb', line 361
def bypass_document_validation spec[BYPASS_DOC_VALIDATION] end
#coll_name ⇒ String
The name of the collection to which the operation should be sent.
#collation ⇒ Hash
The collation to apply to the operation.
# File 'lib/mongo/operation/shared/specifiable.rb', line 373
def collation send(self.class::IDENTIFIER).first[COLLATION] end
#command(connection) ⇒ Hash
The command.
# File 'lib/mongo/operation/shared/specifiable.rb', line 517
def command(connection) selector(connection) end
#cursor_count ⇒ Integer
Get the cursor count from the spec.
# File 'lib/mongo/operation/shared/specifiable.rb', line 168
def cursor_count spec[CURSOR_COUNT] end
#cursor_id ⇒ Integer
The id of the cursor created on the server.
#db_name ⇒ String
The name of the database to which the operation should be sent.
#delete ⇒ Hash
Get the delete document from the specification.
#deletes ⇒ Array<BSON::Document>
Get the deletes from the specification.
#documents ⇒ Array<BSON::Document>
The documents to in the specification.
#eql?(other)
Alias for #==.
# File 'lib/mongo/operation/shared/specifiable.rb', line 158
alias eql? ==
#index ⇒ Hash
Get the index from the specification.
#index_id ⇒ String
Get the index id from the spec.
# File 'lib/mongo/operation/shared/specifiable.rb', line 259
def index_id spec[:index_id] end
#index_name ⇒ String
Get the index name from the spec.
# File 'lib/mongo/operation/shared/specifiable.rb', line 271
def index_name spec[INDEX_NAME] end
#indexes ⇒ Hash
Get the indexes from the specification.
#initialize(spec)
Create the new specifiable operation.
#max_time_ms ⇒ Hash
Get the max time ms value from the spec.
# File 'lib/mongo/operation/shared/specifiable.rb', line 349
def max_time_ms spec[MAX_TIME_MS] end
#namespace ⇒ String
The namespace, consisting of the db name and collection name.
#operation_id ⇒ Integer
Get the operation id for the operation. Used for linking operations in monitoring.
# File 'lib/mongo/operation/shared/specifiable.rb', line 311
def operation_id spec[OPERATION_ID] end
#options(_connection) ⇒ Hash
Get the options for executing the operation on a particular connection.
#read ⇒ Mongo::ServerSelector
The read preference for this operation.
#read_concern ⇒ Hash
The document may include afterClusterTime.
Get the read concern document from the spec.
# File 'lib/mongo/operation/shared/specifiable.rb', line 337
def read_concern spec[READ_CONCERN] end
#selector(_connection) ⇒ Hash
The selector from the specification for execution on a particular connection.
#session ⇒ Session
The session to use for the operation.
# File 'lib/mongo/operation/shared/specifiable.rb', line 492
def session @spec[:session] end
#update ⇒ Hash
The update document from the spec.
#updates ⇒ Array<BSON::Document>
The update documents from the spec.
#user ⇒ Auth::User
The user for user related operations.
#user_name ⇒ String
The user name from the specification.
#write_concern ⇒ Mongo::WriteConcern
The write concern to use for this operation.
# File 'lib/mongo/operation/shared/specifiable.rb', line 444
def write_concern @spec[WRITE_CONCERN] end